java 在 IntelliJ IDEA 中设计 JFrame

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14349413/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 15:58:10  来源:igfitidea点击:

Design a JFrame in IntelliJ IDEA

javaformsuser-interfaceintellij-ideajframe

提问by nlowe

Trying out IntelliJ IDEA, and I can't for the life of me figure out how to design a JFrame. In Eclipse, the WindowBuilder would create a new sub-class of JFrame and generate Java Source Code. I have changed IDEA's settings to generate to java source code, but IDEA appears to like generating JPanels and setting them as the Root Pane of an instance of JFrame. Am I over-looking something or is this a design choice?

尝试使用 IntelliJ IDEA,我终生无法弄清楚如何设计 JFrame。在 Eclipse 中,WindowBuilder 将创建一个新的 JFrame 子类并生成 Java 源代码。我已将 IDEA 的设置更改为生成 Java 源代码,但 IDEA 似乎喜欢生成 JPanel 并将它们设置为 JFrame 实例的根窗格。我是在看什么东西还是这是一个设计选择?

回答by CrazyCoder

It's a design choice, you need to write your own code creating a top level frame, then you can add a panel created in the GUI designer to it. The same affects the inability to design JMenu and status bar.

这是一个设计选择,您需要编写自己的代码来创建顶级框架,然后您可以向其中添加在 GUI 设计器中创建的面板。同样影响无法设计JMenu和状态栏。

If you are looking for a more advanced GUI designer for IDEA (and other IDEs), check out JFormDesigner.

如果您正在为 IDEA(和其他 IDE)寻找更高级的 GUI 设计器,请查看JFormDesigner