[英]How do I get my netbeans drag and drop widget to know whether it is rendering inside the netbeans design view window or the running application?
[英]how to set components invisible in netbeans drag and drop design view
我想在 netbeans 設計視圖中將組件設置為不可見,然后在發生某些事件時從編碼中顯示。 是否可以?
當您使用 Netbeans 創建NewJFrameForm
,在設計視圖中您可以拖放調色板中的所有可用組件。
為了在開始時設置初始不可見/隱藏,您必須手動進行。 單擊上面的源,現在您可以看到您設計的框架的生成源。 您將看到構造函數為:
public NewJFrame() {
initComponents();
}
自己產生的。 現在你必須把你自己的代碼更新,就像在我的情況下,我將設置隱形我的組件,比如:
jPanel1.setVisible(false);
或者
具體成分:
jButton1.setVisible(false);
jToggleButton1.setVisible(false);
jLabel1.setVisible(false);
如果喜歡這樣:
public NewJFrame() {
initComponents();
mySettings();
}
public void mySettings(){
//Hide or set initial Values of components
}
筆記:
您生成的所有代碼都在
initComponents();
你不能在源代碼中編輯它,必須在設計視圖中進行
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.