Java Reference
In-Depth Information
If you're not sure which look and feel designs are available on your operating system,
you can list them with the following statements:
UIManager.LookAndFeelInfo[] laf = UIManager.getInstalledLookAndFeels();
for (int i = 0; i < laf.length; i++) {
System.out.println(“Class name: “ + laf[i].getClassName());
System.out.println(“Name: “ + laf[i].getName() + “\n”);
}
On a Windows system, these statements produce the following output:
Name: Metal
Class name: javax.swing.plaf.metal.MetalLookAndFeel
Name: CDE/Motif
Class name: com.sun.java.swing.plaf.motif.MotifLookAndFeel
Name: Windows
Class name: com.sun.java.swing.plaf.windows.WindowsLookAndFeel
10
Name: Windows Classic
Class name: com.sun.java.swing.plaf.windows.WindowsClassicLookAndFeel).
For copyright reasons, neither the Windows nor Mac OS look and
feel designs will be present on computers that aren't running
those particular operating systems. You won't be able to use the
Mac look and feel on a Windows computer, or vice versa.
CAUTION
Standard Dialog Boxes
The JOptionPane class offers several methods that can be used to create standard dialog
boxes: small windows that ask a question, warn a user, or provide a brief, important mes-
sage. Figure 10.4 shows an example.
FIGURE 10.4
A standard dialog
box.
Figure 10.4 and the remaining examples today use the Metal look and feel, the cross-
platform design that is the default appearance of Java software.
Search WWH ::




Custom Search