Home > OS >  Why does my windowbuilder UI look different when i start the program?
Why does my windowbuilder UI look different when i start the program?

Time:11-06

im using WindowBuilder to create an UI easily. The problem now: The interface looks different in WindowBuilder and when I run the program as java application. See here: In WindowBuilder

When the program is runned as java application

What can I do to make it look like the WindowBuilder preview when I start the program?

CodePudding user response:

You can alter the overall look of your app by setting a Look and Feel.

 try {
   for (javax.swing.UIManager.LookAndFeelInfo laf : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Classic Windows".equals(laf.getName())) {
                    javax.swing.UIManager.setLookAndFeel(laf.getClassName());
                    break;
                }
            }
        } catch (UnsupportedLookAndFeelException | ClassNotFoundException | InstantiationException |
                 IllegalAccessException e) {
            throw new RuntimeException(e);
  }

  • Related