So, now we've got this cool program, but it looks kinda ugly. And there is a way to fix that, through the UIManager class. If you type
for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
}
System.out.println(info.getName());
}
At the top be sure to put
import javax.swing.UIManager;
import javax.swing.UIManager.LookAndFeelInfo;
When you run the application, it will print out all the installed look and feels you have. I perfer nimbus, as do most people. However, there may be another you like. If you want your application to look like a native one, simply put
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
Next chapter, I'll start looking at adding functionality for the program.
ESTÁS LEYENDO
Java Swing GUI Development
No FicciónLearn all the necessities of Java Swing GUI development right here, from me, not some huge cooperate company, that can't find a good way to get the message across. Learn it here, learn it once.
