UIManager manages the current look and feel and its defaults.
The UIManager
manages the current look and feel, the set of available look and feels, PropertyChangeListeners
that are notified when the look and feel changes, look and feel defaults, and convenience methods for obtaining various default values.
Specifying the look and feel
The look and feel can be specified in two distinct ways: by specifying the fully qualified name of the class for the look and feel, or by creating an instance of LookAndFeel
and passing it to setLookAndFeel
.
Setting the look and feel to the system look and feel:
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
Setting the look and feel based on class name:
UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
Defaults
UIManager
manages three sets of UIDefaults
. They are:
1. Developer defaults - With few exceptions Swing does not alter the developer defaults; these are intended to be modified and used by the developer.
2. Look and feel defaults - The look and feel defaults are supplied by the look and feel at the time it is installed as the current look and feel (setLookAndFeel()
is invoked). The look and feel defaults can be obtained using the getLookAndFeelDefaults()
method.
3. System defaults - The system defaults are provided by Swing.