I'm a Java/Netbeans newbie learning how to make a GUI.
I was following this tutorial, and I noticed that the "finished" product (first picture in that link) doesn't look like the GUI built through the steps.
Why is that? I mean, when I click on the preview button, the GUI looks native (nice) as well. It's just when it's deployed that it looks all...mmm...bad. lol.
Is there a way to make the finished GUI looks native? Is it Netbeans settings or Java settings?
Note: I'm developing this on Windows.
Use the following code to force swing to select the "system" look and feel:
String laf = UIManager.getSystemLookAndFeelClassName();
UIManager.setLookAndFeel(laf);
The default "Look and Feel" is metal-like, which is good and nice for cross-platform applications.
JDK has 4 built-in "look and feel" ('til now), which are:
you can try any of these "look and feel"s in 1 line, example code:
UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
NOTE: invoke/call this method of changing the "look and feel" before any GUI implementation, or it may throw some exception
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With