【问题标题】:IntelliJ - can't load FormPreviewFrame.class in the GUI DesignerIntelliJ - 无法在 GUI 设计器中加载 FormPreviewFrame.class
【发布时间】:2020-05-12 17:42:19
【问题描述】:

我是 Intellij IDEA(社区版 2020.1)的新手,我想尝试一个简单的 JSwing 表单。表单在运行时显示良好,但问题出在 GUI 编辑器/设计器上,如果我尝试预览表单,它会显示“无法加载 FormPreviewFrame.class”

我还有一个补充问题,我看到在 GUI Designer 中创建了一个默认的 JPanel,这是创建的 JFrame 的默认内容窗格吗?我的意思是我需要将该 JPanel 添加到 JFrame 中吗? (尽管它在没有添加的情况下工作)

已编辑更新:我认为这是一个尚未修复的旧错误,如 HEREHERE 所述

以下是我的简单JFrame,我将“MyMainForm”类绑定到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);
    }
}

【问题讨论】:

标签: java intellij-idea


【解决方案1】:

这是known bug。该修复程序将在 2020.1.2 更新中提供。

【讨论】:

  • 是的,我刚刚找到它并更新了我的问题。谢谢你
猜你喜欢
  • 2020-09-02
  • 1970-01-01
  • 2018-06-08
  • 1970-01-01
  • 2013-02-27
  • 1970-01-01
  • 1970-01-01
  • 2014-05-23
  • 2023-03-15
相关资源
最近更新 更多