Col*_*ing 5 java eclipse user-interface windowbuilder
我正在使用WindowBuilder for Eclipse Java.
当我创建一个Button或Menu(或任何东西)时,它会创建嵌套在构造函数中的字段.有没有办法让它们成为字段,然后在构造函数中初始化,以便我可以在构造函数之外使用它们?谢谢.
即:FROM
public GUIFrame() {
JMenuBar menuBar = new JMenuBar();
}
Run Code Online (Sandbox Code Playgroud)
至
public JMenuBar menubar;
public GUIFrame() {
menuBar = new JMenuBar();
}
Run Code Online (Sandbox Code Playgroud)
Chr*_*911 12
有一个按钮可以将元素从"local to field"转换为"local".

如果您希望默认情况下所有组件都是字段:Windows - >首选项 - > WindowBuilder - > Swing - >代码生成 - >查找"变量生成"并选择"字段"选项卡.
| 归档时间: |
|
| 查看次数: |
3532 次 |
| 最近记录: |