Overview | Package | Class | Tree | Deprecated | Index | Help Java Platform
1.1.7
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

Class com.sun.java.swing.UIManager

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

public class UIManager
extends java.lang.Object
implements java.io.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.

See Also:
Serialized Form

Inner Class Summary
static  UIManager.LookAndFeelInfo
          Provide a little information about an installed LookAndFeel for the sake of configuring a menu or for initial application set up.
 
Method Summary
static void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Add a PropertyChangeListener to the listener list.
static LookAndFeel[] getAuxiliaryLookAndFeels()
          Return the list of auxiliary look and feels (can be null).
static Border getBorder(java.lang.Object key)
           
static java.awt.Color getColor(java.lang.Object key)
           
static java.lang.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.
static UIDefaults getDefaults()
           
static java.awt.Font getFont(java.lang.Object key)
           
static Icon getIcon(java.lang.Object key)
           
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.
static UIDefaults getLookAndFeelDefaults()
           
static LookAndFeel getLookAndFeel()
          Returns The current default look and feel, or null.
static java.lang.String getString(java.lang.Object key)
           
static java.lang.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 java.lang.Object get(java.lang.Object key)
           
static com.sun.java.swing.plaf.ComponentUI getUI(JComponent target)
           
static void installLookAndFeel(UIManager.LookAndFeelInfo info)
          Adds the specified look and feel to the current array and then calls setInstalledLookAndFeels.
static void installLookAndFeel(java.lang.String name, java.lang.String className)
           
static java.lang.Object put(java.lang.Object key, java.lang.Object value)
           
static void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Remove a PropertyChangeListener from the listener list.
static void setInstalledLookAndFeels(UIManager.LookAndFeelInfo[] infos)
          Replaces the current array of installed LookAndFeelInfos.
static void setLookAndFeel(LookAndFeel newLookAndFeel)
          Set the current default look and feel.
static void setLookAndFeel(java.lang.String className)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait
 

Method Detail

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

setInstalledLookAndFeels

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

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

installLookAndFeel

public static void installLookAndFeel(java.lang.String name,
                                      java.lang.String className)

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

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

setLookAndFeel

public static void setLookAndFeel(java.lang.String className)
                          throws java.lang.ClassNotFoundException,
                                 java.lang.InstantiationException,
                                 java.lang.IllegalAccessException,
                                 UnsupportedLookAndFeelException
Throws:
java.lang.ClassNotFoundException - If the LookAndFeel class could not be found.
java.lang.InstantiationException - If a new instance of the class couldn't be creatd.
java.lang.IllegalAccessException - If the class or initializer isn't accessible.
UnsupportedLookAndFeelException - If lnf.isSupportedLookAndFeel() is false.

getSystemLookAndFeelClassName

public static java.lang.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

getCrossPlatformLookAndFeelClassName

public static java.lang.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

getDefaults

public static UIDefaults getDefaults()

getFont

public static java.awt.Font getFont(java.lang.Object key)

getColor

public static java.awt.Color getColor(java.lang.Object key)

getIcon

public static Icon getIcon(java.lang.Object key)

getBorder

public static Border getBorder(java.lang.Object key)

getString

public static java.lang.String getString(java.lang.Object key)

get

public static java.lang.Object get(java.lang.Object key)

put

public static java.lang.Object put(java.lang.Object key,
                         java.lang.Object value)

getUI

public static com.sun.java.swing.plaf.ComponentUI getUI(JComponent target)

getLookAndFeelDefaults

public static UIDefaults getLookAndFeelDefaults()

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

addPropertyChangeListener

public static void addPropertyChangeListener(java.beans.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:
java.beans.PropertyChangeSupport

removePropertyChangeListener

public static void removePropertyChangeListener(java.beans.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:
java.beans.PropertyChangeSupport

Overview | Package | Class | Tree | Deprecated | Index | Help Java Platform
1.1.7
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

Submit a bug or feature
Submit comments/suggestions about javadoc
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.