Java Reference
In-Depth Information
Figure 20-9.
Presentation theme within the Metalworks demonstration program
Using an Auxiliary Look and Feel
Swing provides for multiple look and feel classes to be active at any one time through
the
MultiLookAndFeel
, or as specified by the
swing.plaf.multiplexinglaf
property in the
swing.properties
file. When multiple look and feel classes are installed, only one look and feel
will be visual and paint the screen. The remaining versions are called
auxiliary
look and feel
classes and tend to be associated with accessibility options, such as for screen readers. Another
possible auxiliary look and feel is that of a logger, which records those components that are
interacted with in a log file.
Auxiliary look and feel classes are registered with the runtime environment by config-
uring the
swing.auxiliarylaf
property within the
swing.properties
file. If multiple classes
are specified, the entries need to be separated by commas. In addition to using the properties
file, you can install a look and feel within a program by calling the
public static void
addAuxiliaryLookAndFeel(LookAndFeel lookAndFeel)
method of
UIManager
. Once installed,
the multiplexing look and feel class automatically creates and manages UI delegates for all
the installed look and feel classes.
To find out which auxiliary look and feel classes are installed, you can ask the
UIManager
through its
public static LookAndFeel[ ] getAuxiliaryLookAndFeels()
method. This returns
an array of the actual
LookAndFeel
objects, unlike the
UIManager.LookAndFeelInfo
array returned
by the
getInstalledLookAndFeels()
method.