Issue
I want to set components invisible in the netbeans design view and then show then from coding when some event occurs. Is it possible?
Solution
When you create NewJFrameForm
using Netbeans, In Design view you can drag and drop all the components available in palette.
In order to set initially invisible / hidden at starting you have to do it manually. Click on source above, Now you can see generated source of that frame you designed. You will see constructor as:
public NewJFrame() {
initComponents();
}
Generated itself. now you have to put your own code to update like in my case i will set invisible my compnents like:
jPanel1.setVisible(false);
OR
specific components:
jButton1.setVisible(false);
jToggleButton1.setVisible(false);
jLabel1.setVisible(false);
if prefer this like:
public NewJFrame() {
initComponents();
mySettings();
}
public void mySettings(){
//Hide or set initial Values of components
}
Note:
all your generated code is in
initComponents();
you can not edit it in source, have to do it in design view
Answered By - Sarz
Answer Checked By - Marie Seifert (JavaFixing Admin)