is new.
java.lang.Objectjavax.swing.UIManager
This class keeps track of the current look and feel and its defaults. The default look and feel class is chosen in the following manner:
We manage three levels of defaults: user defaults, look and feel defaults, system defaults. A call to UIManager.get checks all three levels in order and returns the first non-null value for a key, if any. A call to UIManager.put just affects the user defaults. Note that a call to setLookAndFeel doesn't affect the user defaults, it just replaces the middle defaults "level".
Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans TM has been added to the java.beans package. Please see XMLEncoder .
| Nested Class Summary | |
|---|---|
| static class |
UIManager.LookAndFeelInfo
Provides a little information about an installed LookAndFeel for the sake of configuring a menu or for initial application set up. |
| Constructor Summary | |
|---|---|
|
UIManager
() |
|
| Method Summary | |
|---|---|
| static void |
addAuxiliaryLookAndFeel
(
LookAndFeel
laf) Adds a LookAndFeel to the list of auxiliary look and feels. |
| static void |
addPropertyChangeListener
(
PropertyChangeListener
listener) Adds a PropertyChangeListener to the listener list. |
| static Object |
get
(
Object
key) Returns an object from the defaults table. |
| static Object |
get
(
Object
key,
Locale
l) Returns an object from the defaults table that is appropriate for the given locale. |
| static LookAndFeel [] |
getAuxiliaryLookAndFeels
() Returns the list of auxiliary look and feels (can be null). |
| static boolean |
getBoolean
(
Object
key) Returns a boolean from the defaults table which is associated with the key value. |
| static boolean |
getBoolean
(
Object
key,
Locale
l) Returns a boolean from the defaults table which is associated with the key value and the given Locale. |
| static Border |
getBorder
(
Object
key) Returns a border from the defaults table. |
| static Border |
getBorder
(
Object
key,
Locale
l) Returns a border from the defaults table that is appropriate for the given locale. |
| static Color |
getColor
(
Object
key) Returns a drawing color from the defaults table. |
| static Color |
getColor
(
Object
key,
Locale
l) Returns a drawing color from the defaults table that is appropriate for the given locale. |
| static String |
getCrossPlatformLookAndFeelClassName
() Returns the name of the LookAndFeel class that implements the default cross platform look and feel -- the Java Look and Feel (JLF). |
| static UIDefaults |
getDefaults
() Returns the default values for this look and feel. |
| static Dimension |
getDimension
(
Object
key) Returns a dimension from the defaults table. |
| static Dimension |
getDimension
(
Object
key,
Locale
l) Returns a dimension from the defaults table that is appropriate for the given locale. |
| static Font |
getFont
(
Object
key) Returns a drawing font from the defaults table. |
| static Font |
getFont
(
Object
key,
Locale
l) Returns a drawing font from the defaults table that is appropriate for the given locale. |
| static Icon |
getIcon
(
Object
key) Returns an Icon from the defaults table. |
| static Icon |
getIcon
(
Object
key,
Locale
l) Returns an Icon from the defaults table that is appropriate for the given locale. |
| static Insets |
getInsets
(
Object
key) Returns an Insets object from the defaults table. |
| static Insets |
getInsets
(
Object
key,
Locale
l) Returns an Insets object from the defaults table that is appropriate for the given locale. |
| static UIManager.LookAndFeelInfo [] |
getInstalledLookAndFeels
() Returns an array of objects that provide some information about the LookAndFeel implementations that have been installed with this software development kit. |
| static int |
getInt
(
Object
key) Returns an integer from the defaults table. |
| static int |
getInt
(
Object
key,
Locale
l) Returns an integer from the defaults table that is appropriate for the given locale. |
| static LookAndFeel |
getLookAndFeel
() Returns the current default look and feel or null. |
| static UIDefaults |
getLookAndFeelDefaults
() Returns the default values for this look and feel. |
| static PropertyChangeListener [] |
getPropertyChangeListeners
() Returns an array of all the PropertyChangeListeners added to this UIManager with addPropertyChangeListener(). |
| static String |
getString
(
Object
key) Returns a string from the defaults table. |
| static String |
getString
(
Object
key,
Locale
l) Returns a string from the defaults table that is appropriate for the given locale. |
| static String |
getSystemLookAndFeelClassName
() Returns the name of the LookAndFeel class that implements the native systems look and feel if there is one, otherwise the name of the default cross platform LookAndFeel class. |
| static ComponentUI |
getUI
(
JComponent
target) Returns the L&F object that renders the target component. |
| static void |
installLookAndFeel
(
String
name,
String
className) Creates a new look and feel and adds it to the current array. |
| static void |
installLookAndFeel
(
UIManager.LookAndFeelInfo
info) Adds the specified look and feel to the current array and then calls setInstalledLookAndFeels(javax.swing.UIManager.LookAndFeelInfo[]) . |
| static Object |
put
(
Object
key,
Object
value) Stores an object in the defaults table. |
| static boolean |
removeAuxiliaryLookAndFeel
(
LookAndFeel
laf) Removes a LookAndFeel from the list of auxiliary look and feels. |
| static void |
removePropertyChangeListener
(
PropertyChangeListener
listener) Removes a PropertyChangeListener from the listener list. |
| static void |
setInstalledLookAndFeels
(
UIManager.LookAndFeelInfo
[] infos) Replaces the current array of installed LookAndFeelInfos. |
| static void |
setLookAndFeel
(
LookAndFeel
newLookAndFeel) Sets the current default look and feel using a LookAndFeel object. |
| static void |
setLookAndFeel
(
String
className) Sets the current default look and feel using a class name. |
| Methods inherited from class java.lang. Object |
|---|
| clone , equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait |
| Constructor Detail |
|---|
public UIManager()
| Method Detail |
|---|
public static UIManager.LookAndFeelInfo[] getInstalledLookAndFeels()
Given a LookAndFeelInfo object one can set the current look and feel like this:
UIManager.setLookAndFeel(info.getClassName());
public static void setInstalledLookAndFeels(UIManager.LookAndFeelInfo[] infos)
throws SecurityException
public static void installLookAndFeel(UIManager.LookAndFeelInfo info)
public static void installLookAndFeel(String name,
String className)
public static LookAndFeel getLookAndFeel()
public static void setLookAndFeel(LookAndFeel newLookAndFeel)
throws UnsupportedLookAndFeelException
This is a JavaBeans bound property.
public static void setLookAndFeel(String className)
throws ClassNotFoundException,
InstantiationException,
IllegalAccessException,
UnsupportedLookAndFeelException
public static String getSystemLookAndFeelClassName()
If the system property swing.systemlaf has been defined, its value will be returned.
public static String getCrossPlatformLookAndFeelClassName()
If the system property swing.crossplatformlaf has been defined, its value will be returned.
public static UIDefaults getDefaults()
public static Font getFont(Object key)
public static Font getFont(Object key,
Locale l)
public static Color getColor(Object key)
public static Color getColor(Object key,
Locale l)
public static Icon getIcon(Object key)
public static Icon getIcon(Object key,
Locale l)
public static Border getBorder(Object key)
public static Border getBorder(Object key,
Locale l)
public static String getString(Object key)
public static String getString(Object key,
Locale l)
public static int getInt(Object key)
public static int getInt(Object key,
Locale l)
public static boolean getBoolean(Object key)
public static boolean getBoolean(Object key,
Locale l)
public static Insets getInsets(Object key)
public static Insets getInsets(Object key,
Locale l)
public static Dimension getDimension(Object key)
public static Dimension getDimension(Object key,
Locale l)
public static Object get(Object key)
public static Object get(Object key,
Locale l)
public static Object put(Object key,
Object value)
public static ComponentUI getUI(JComponent target)
public static UIDefaults getLookAndFeelDefaults()
public static void addAuxiliaryLookAndFeel(LookAndFeel laf)
Note these are not the same as the installed look and feels.
public static boolean removeAuxiliaryLookAndFeel(LookAndFeel laf)
Note these are not the same as the installed look and feels.
public static LookAndFeel[] getAuxiliaryLookAndFeels()
Note these are not the same as the installed look and feels.
public static void addPropertyChangeListener(PropertyChangeListener listener)
public static void removePropertyChangeListener(PropertyChangeListener listener)
public static PropertyChangeListener[] getPropertyChangeListeners()