For best portability use the default Java cross-platform Look & Feel. There are several good reasons to change it however.
The javax.swing.UIManager class methods can be used to set it.
try {
UIManager.setLookAndFeel(XXX);
} catch (Exception e) {
// This is one of the few places where silently ignoring an exception
// might be the right thing to do, altho it is almost always
// a very bad practice. What else can we do in this case?
// The default look & feel will be used if we ignore this.
}
Where XXX is one of the following:
UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());"com.sun.java.swing.plaf.windows.WindowsLookAndFeel"
can currently only be used on Windows."javax.swing.plaf.mac.MacLookAndFeel"
can currently only be used on the Macintosh [still true?].
Note: The look and feel code doesn't move menu elements around to match the
the relevant system."com.sun.java.swing.plaf.motif.MotifLookAndFeel"
can be used on any system.A number of custom Looks and Feels have been developed. Take a look at www.javootoo.com for examples and links to some. A nice L&F for informal appearance is Napkin, at napkinlaf.sourceforge.net/.
You can easily install these: just put the .jar file in
the CLASSPATH, and make the ap