Netbeans Swing:变量声明消失了

时间:2011-02-10 15:36:23

标签: swing netbeans

有一个问题: 刚刚通过调整一些按钮并重新编译来修改我的Swing GUI ...然后:

cannot find symbol symbol: variable MachineStatusLabel以及其他对象的更多内容...

是的,这是我GUI中的标签,不知道为什么找不到它。生成的代码部分包含通常的内容,如
javax.swing.JLabel MachineStatusLabel = new javax.swing.JLabel();
并定义一切。但是看看Variables declaration - do not modify - 部分,几乎所有的GUI对象都消失了!只剩下两个了:

// Variables declaration - do not modify
private javax.swing.JLabel statusAnimationLabel;
private javax.swing.JLabel statusMessageLabel;
// End of variables declaration

有没有办法让NetBeans将整个GUI重建为这个生成的代码?不知何故,GUI对象似乎刚被NetBeans搞砸了:-(手动添加缺失对象的声明也无济于事......

提前致谢!
帕特里克

1 个答案:

答案 0 :(得分:0)

您应该仔细检查“选项”对话框中“将组件生成为”属性的值。

选项出现在杂项类别的GUI Builder选项卡中。

这是截图...

enter image description here

听起来您需要将属性值设置为“表单类中的字段”。

如果更改选项值,您可能需要对表单进行微小更改以触发代码重新生成。