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.
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.
}
Your question is already answered here
In Eclipse go to
Window > Preferences > WindowBuilder > Swing > LookAndFeel
and check
Apply choosen LookAndFeel in main() method.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.