首页 > 解决方案 > Swing Designer 中的 Intellij FlatLAF 在编译后的应用程序中不起作用

问题描述

我正在尝试使用 swing 制作应用程序,我设法使用 Intellij 的 swing 设计器来构建 GUI,我制作了一个简单的 JPanel 并将其添加到框架中,但是在 Intellij 的设计器中,FlatLAF 被用作库,当我运行应用程序,我看到了默认的摆动组件,没有丢失任何组件,但是,FlatLAF 没有如下图所示工作,我知道我遗漏了一些东西,但我不知道它是什么,这里是带有代码的简单示例。

import javax.swing.*;
import java.awt.*;

public class WelcomeScreen extends JFrame {
    private JPanel containerPanel;
    private JTextArea programDescription;
    private JCheckBox agreeCheckbox;
    private JButton okButton;
    private JLabel titleLabel;
    public static ImageIcon peopleIcon;

    WelcomeScreen(){
        peopleIcon = new ImageIcon("People Icon.png");

        this.setSize(500, 300);
        this.setTitle("Account Manager - Welcome Screen");
        this.setContentPane(containerPanel);
        this.setMinimumSize(new Dimension(500, 300));
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.setIconImage(peopleIcon.getImage());
        this.setLocationRelativeTo(null);
        //this.setResizable(false);
        this.setVisible(true);
    }
}

在编辑器中: 在此处输入图像描述 在编译的应用程序中: 在此处输入图像描述

标签: javaswingintellij-idea

解决方案


推荐阅读