javawindowsexportwindowbuilder

Windows style in Windowbuilder


Hey I coded a calculator. In the design Tab I set it to Windows but wehn I export it, its the nasty "Metal" theme. And it dosnt look like i designed it. Sincerely Jonathan

The Eclipse View

When I export it


Solution

  • The solution is:

    First you need to go to: Window > Preferences > WindowBuilder > Swing > LookAndFeel

    Then you tick Windows > Apply & Close

    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();
                }
            }
        });
    }