开发者

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...

Netbeans Swing: Variables declaration disappeared

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜