当前位置: 动力学知识库 > 问答 > 编程问答 >

Netbeans Swing: Variables declaration disappeared

问题描述:

Got a question:

Just modified my Swing GUI a bit by resizing some buttons and recompiled...then:

cannot find symbol symbol: variable MachineStatusLabel and more of the same for other Objects...

Yep, this is a Label in my GUI, no idea why it cannot be found. The generated code section contains the usual stuff like

javax.swing.JLabel MachineStatusLabel = new javax.swing.JLabel();

and defines everything. But looking at the Variables declaration - do not modify-Section, almost all GUI Objects disappeared! There are only two left:

// Variables declaration - do not modify

private javax.swing.JLabel statusAnimationLabel;

private javax.swing.JLabel statusMessageLabel;

// End of variables declaration

Is there a way to let NetBeans rebuild the whole GUI into this generated code? Somehow the GUI Objects seem to have just been messed up by NetBeans :-( Adding the declarations for the missing Objects manually didn't help either...

Thanks in advance!

Patrick

网友答案:

You should double check the value of the 'Generate Components as' property in the Options dialog.

The Option appears of the GUI Builder tab of the Miscellaneous category.

Here is the screenshot...

It sounds like you need to have the property value set as 'Fields in Form Class'.

If you change the option value, you will probably need to make a minor change in your form to trigger a code regeneration, too.

分享给朋友:
您可能感兴趣的文章:
随机阅读: