Windows Windowbuilder 中的样式

Windows style in Windowbuilder

嘿,我编写了一个计算器。在设计选项卡中,我将其设置为 Windows 但我将其导出时,它是令人讨厌的“金属”主题。它看起来不像是我设计的。此致 乔纳森

The Eclipse View

When I export it

解决方法是:

首先您需要转到:Window > 首选项 > WindowBuilder > Swing > LookAndFeel

然后勾选 Windows > 应用并关闭

public static void main(String[] args) {
    try {
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch(Exception e) {
        System.out.println("Error setting native LAF: " + e);
    }
    EventQueue.invokeLater(new Runnable() {
        public void run() {
            try {
                YourFrame frame = new YourFrame();
                frame.setVisible(true);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
}