Java Reference
In-Depth Information
need to look good in all cases). You saw Nimbus mentioned (a SwingLabs project) as a notable
exception. You can enable it by inserting the following code at the top of your main method:
try {
for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (Exception e) {
// Nimbus not available, revert to system look and feel
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception ign) {}
}
(This snippet also shows you how to get a list of available look and feels.) The Nimbus look and feel
looks like Figure 11-3 (using the “SwingSet” example provided by Oracle).
Feel free to use it in your own projects or just stick with the defaults.
figure 11-3  
Search WWH ::




Custom Search