![](/img/trans.png)
[英]I can't resize or move elements on Intellij IDEA GUI designer
[英]IntelliJ - can't load FormPreviewFrame.class in the GUI Designer
我是 Intellij IDEA(社区版 2020.1)的新手,我想尝试一个简单的 JSwing 表单。 表单在运行时显示良好,但问题出在 GUI 编辑器/设计器上,如果我尝试预览表单,它会显示“无法加载 FormPreviewFrame.class”
我还有一个补充问题,我看到在 GUI Designer 中创建了一个默认的 JPanel,这是创建的 JFrame 的默认内容窗格吗? 我的意思是我需要将该 JPanel 添加到 JFrame 吗? (尽管它在没有添加的情况下工作)
更新已编辑:我认为这是一个尚未修复的旧错误,如HERE和HERE所述
以下是我的简单JFrame,我将“MyMainForm”class绑定到UI Form(.form)
class MyMainForm extends JFrame{
private JPanel panel;
private JLabel lbl;
private JButton btn;
public MyMainForm(String title) throws HeadlessException {
super(title);
//setSize( 150, 100 );
setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
this.panel = new JPanel();
this.lbl = new JLabel("Result");
this.btn = new JButton("Calculate");
panel.setBackground(Color.blue);
this.setLayout(new FlowLayout());
this.setBounds(400,200,500,500);
add(lbl);
add(btn);
this.pack();
}
}
public class MyFrameTest {
public static void main(String[] args) {
MyMainForm frm= new MyMainForm("Calculator");
frm.setVisible(true);
}
}
这是一个已知的错误。 该修复程序将在 2020.1.2 更新中提供。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.