All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sun.java.swing.UIManager

java.lang.Object
   |
   +----com.sun.java.swing.UIManager

public class UIManager
extends Object
implements Serializable
This class keeps track of the current look and feel and its defaults.

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 Swing1.0 applications. It will not be possible to load serialized Swing1.0 objects with future releases of Swing. The JDK1.2 release of Swing will be the compatibility baseline for the serialized form of Swing objects.


Constructor Index

 o UIManager()

Method Index

 o addPropertyChangeListener(PropertyChangeListener)
Add a PropertyChangeListener to the listener list.
 o get(Object)
 o getAuxiliaryLookAndFeels()
Return the list of auxiliary look and feels (can be null).
 o getBorder(Object)
 o getColor(Object)
 o getCrossPlatformLookAndFeelClassName()
Returns the name of the LookAndFeel class that implements the default cross platform look and feel, i.e.
 o getDefaults()
 o getFont(Object)
 o getIcon(Object)
 o getInstalledLookAndFeels()
Return an array of objects that provide some information about the LookAndFeel implementations that have been installed with this java development kit.
 o getLookAndFeel()
Returns The current default look and feel, or null.
 o getLookAndFeelDefaults()
 o getString(Object)
 o 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.
 o getUI(JComponent)
 o installLookAndFeel(String, String)
 o installLookAndFeel(UIManager. LookAndFeelInfo)
Adds the specified look and feel to the current array and then calls setInstalledLookAndFeels.
 o put(Object, Object)
 o removePropertyChangeListener(PropertyChangeListener)
Remove a PropertyChangeListener from the listener list.
 o setInstalledLookAndFeels(UIManager. LookAndFeelInfo[])
Replaces the current array of installed LookAndFeelInfos.
 o setLookAndFeel(LookAndFeel)
Set the current default look and feel.
 o setLookAndFeel(String)

Constructors

 o UIManager
 public UIManager()

Methods

 o getInstalledLookAndFeels
 public static UIManager. LookAndFeelInfo[] getInstalledLookAndFeels()
Return an array of objects that provide some information about the LookAndFeel implementations that have been installed with this java development kit. The LookAndFeel info objects can be used by an application to construct a menu of look and feel options for the user or to set the look and feel at start up time. Note that we do not return the LookAndFeel classes themselves here to avoid the cost of unnecessarily loading them.

Given a LookAndFeelInfo object one can set the current look and feel like this:

 UIManager.setLookAndFeel(info.getClassName());
 

See Also:
setLookAndFeel
 o setInstalledLookAndFeels
 public static void setInstalledLookAndFeels(UIManager. LookAndFeelInfo infos[]) throws SecurityException
Replaces the current array of installed LookAndFeelInfos.

See Also:
getInstalledLookAndFeels
 o installLookAndFeel
 public static void installLookAndFeel(UIManager. LookAndFeelInfo info)
Adds the specified look and feel to the current array and then calls setInstalledLookAndFeels.

See Also:
setInstalledLookAndFeels
 o installLookAndFeel
 public static void installLookAndFeel(String name,
                                       String className)
 o getLookAndFeel
 public static LookAndFeel getLookAndFeel()
Returns The current default look and feel, or null.

Returns:
The current default look and feel, or null.
See Also:
setLookAndFeel
 o setLookAndFeel
 public static void setLookAndFeel(LookAndFeel newLookAndFeel) throws UnsupportedLookAndFeelException
Set the current default look and feel.

This is a JavaBeans bound property.

Throws: UnsupportedLookAndFeelException
If lnf.isSupportedLookAndFeel() is false.
See Also:
getLookAndFeel
 o setLookAndFeel
 public static void setLookAndFeel(String className) throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException
Throws: ClassNotFoundException
If the LookAndFeel class could not be found.
Throws: InstantiationException
If a new instance of the class couldn't be creatd.
Throws: IllegalAccessException
If the class or initializer isn't accessible.
Throws: UnsupportedLookAndFeelException
If lnf.isSupportedLookAndFeel() is false.
 o getSystemLookAndFeelClassName
 public 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.

See Also:
setLookAndFeel, getCrossPlatformLookAndFeelClassName
 o getCrossPlatformLookAndFeelClassName
 public static String getCrossPlatformLookAndFeelClassName()
Returns the name of the LookAndFeel class that implements the default cross platform look and feel, i.e. the "Java Look and Feel", or JLF.

Returns:
a string with the JLF implementation-class
See Also:
setLookAndFeel, getSystemLookAndFeelClassName
 o getDefaults
 public static UIDefaults getDefaults()
 o getFont
 public static Font getFont(Object key)
 o getColor
 public static Color getColor(Object key)
 o getIcon
 public static Icon getIcon(Object key)
 o getBorder
 public static Border getBorder(Object key)
 o getString
 public static String getString(Object key)
 o get
 public static Object get(Object key)
 o put
 public static Object put(Object key,
                          Object value)
 o getUI
 public static ComponentUI getUI(JComponent target)
 o getLookAndFeelDefaults
 public static UIDefaults getLookAndFeelDefaults()
 o getAuxiliaryLookAndFeels
 public static LookAndFeel[] getAuxiliaryLookAndFeels()
Return the list of auxiliary look and feels (can be null). The auxiliary look and feels tell the multiplexing look and feel what other LookAndFeel classes for a component instance are to be used in addition to the default LookAndFeel class when creating a multiplexing UI.

Note these are not the same as the installed look and feels.

See Also:
getInstalledLookAndFeels
 o addPropertyChangeListener
 public static synchronized void addPropertyChangeListener(PropertyChangeListener listener)
Add a PropertyChangeListener to the listener list. The listener is registered for all properties.

Parameters:
listener - The PropertyChangeListener to be added
See Also:
PropertyChangeSupport
 o removePropertyChangeListener
 public static synchronized void removePropertyChangeListener(PropertyChangeListener listener)
Remove a PropertyChangeListener from the listener list. This removes a PropertyChangeListener that was registered for all properties.

Parameters:
listener - The PropertyChangeListener to be removed
See Also:
PropertyChangeSupport

All Packages  Class Hierarchy  This Package  Previous  Next  Index