0

I'm learning Java Swing by writing this application and editing in Window Builder, but what I can see is that the appearance of application when I run it is different than the one I edit in Window Builder. To be specific, the one in Window Builder I like more. I checked up for some kind of skins in Window Builder and selected "Nimbus". Can I make something so that application is same look like when I run it as the one in Window Builder? I'm using Eclipse.

First one is test in Window Builder, second is when I'm running the application.

test in Window Builder

when I Run application

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
user3208593
  • 1
  • 1
  • 2

2 Answers2

0

you can activate different Look and Feels in Swing Applications:

http://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/nimbus.html

I guess thats missing in your running application.

import javax.swing.UIManager.*;

try {
    for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
        if ("Nimbus".equals(info.getName())) {
            UIManager.setLookAndFeel(info.getClassName());
            break;
        }
    }
} catch (Exception e) {
    // If Nimbus is not available, you can set the GUI to another look and feel.
}
DA.
  • 849
  • 6
  • 19
0

Your question is already answered here

In Eclipse go to

Window > Preferences > WindowBuilder > Swing > LookAndFeel

and check

Apply choosen LookAndFeel in main() method.

Community
  • 1
  • 1