|
JavaTM 2 Platform Std. Ed. v1.3.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.swing.UIManager
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 applications running the same version of Swing. A future release of Swing will provide support for long term persistence.
Inner Class Summary | |
static class |
UIManager.LookAndFeelInfo
Provide 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)
Add a LookAndFeel to the list of auxiliary look and feels. |
static void |
addPropertyChangeListener(PropertyChangeListener listener)
Add a PropertyChangeListener to the listener list. |
static Object |
get(Object key)
Returns an object from the defaults table. |
static LookAndFeel[] |
getAuxiliaryLookAndFeels()
Return the list of auxiliary look and feels (can be null). |
static Border |
getBorder(Object key)
Returns a border from the defaults table. |
static Color |
getColor(Object key)
Returns a drawing color from the defaults table. |
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 Font |
getFont(Object key)
Returns a drawing font from the defaults table. |
static Icon |
getIcon(Object key)
Returns an Icon from the defaults table. |
static Insets |
getInsets(Object key)
Returns an Insets object from the defaults table. |
static UIManager.LookAndFeelInfo[] |
getInstalledLookAndFeels()
Return 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 int from the defaults table. |
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 String |
getString(Object key)
Returns a string from the defaults table. |
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)
Remove a LookAndFeel from the list of auxiliary look and feels. |
static void |
removePropertyChangeListener(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 using a LookAndFeel object. |
static void |
setLookAndFeel(String className)
Set 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());
setLookAndFeel(javax.swing.LookAndFeel)
public static void setInstalledLookAndFeels(UIManager.LookAndFeelInfo[] infos) throws SecurityException
getInstalledLookAndFeels()
public static void installLookAndFeel(UIManager.LookAndFeelInfo info)
setInstalledLookAndFeels(javax.swing.UIManager.LookAndFeelInfo[])
.info
- a LookAndFeelInfo object that names the look and feel
and identifies that class that implements itpublic static void installLookAndFeel(String name, String className)
setInstalledLookAndFeels(javax.swing.UIManager.LookAndFeelInfo[])
.name
- a String specifying the name of the look and feelclassName
- a String specifying the class name that implements the
look and feelpublic static LookAndFeel getLookAndFeel()
setLookAndFeel(javax.swing.LookAndFeel)
public static void setLookAndFeel(LookAndFeel newLookAndFeel) throws UnsupportedLookAndFeelException
This is a JavaBeans bound property.
newLookAndFeel
- the LookAndFeel objectUnsupportedLookAndFeelException
- If lnf.isSupportedLookAndFeel()
is false.getLookAndFeel()
public static void setLookAndFeel(String className) throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException
className
- a string specifying the name of the class that implements
the look and feelClassNotFoundException
- If the LookAndFeel class could not be found.InstantiationException
- If a new instance of the class couldn't be creatd.IllegalAccessException
- If the class or initializer isn't accessible.UnsupportedLookAndFeelException
- If lnf.isSupportedLookAndFeel()
is false.public static String getSystemLookAndFeelClassName()
setLookAndFeel(javax.swing.LookAndFeel)
,
getCrossPlatformLookAndFeelClassName()
public static String getCrossPlatformLookAndFeelClassName()
setLookAndFeel(javax.swing.LookAndFeel)
,
getSystemLookAndFeelClassName()
public static UIDefaults getDefaults()
public static Font getFont(Object key)
key
- an Object specifying the fontpublic static Color getColor(Object key)
key
- an Object specifying the colorpublic static Icon getIcon(Object key)
key
- an Object specifying the iconpublic static Border getBorder(Object key)
key
- an Object specifying the borderpublic static String getString(Object key)
key
- an Object specifying the stringpublic static int getInt(Object key)
key
- an Object specifying the intpublic static Insets getInsets(Object key)
key
- an Object specifying the Insets objectpublic static Dimension getDimension(Object key)
key
- an Object specifying the dimension objectpublic static Object get(Object key)
key
- an Object specifying the desired objectpublic static Object put(Object key, Object value)
key
- an Object specifying the retrieval keyvalue
- the Object to storeUIDefaults.put(java.lang.Object, java.lang.Object)
public static ComponentUI getUI(JComponent target)
target
- the JComponent to renderpublic static UIDefaults getLookAndFeelDefaults()
public static void addAuxiliaryLookAndFeel(LookAndFeel laf)
Note these are not the same as the installed look and feels.
laf
- the LookAndFeel objectremoveAuxiliaryLookAndFeel(javax.swing.LookAndFeel)
,
setLookAndFeel(javax.swing.LookAndFeel)
,
getAuxiliaryLookAndFeels()
,
getInstalledLookAndFeels()
public static boolean removeAuxiliaryLookAndFeel(LookAndFeel laf)
Note these are not the same as the installed look and feels.
removeAuxiliaryLookAndFeel(javax.swing.LookAndFeel)
,
getAuxiliaryLookAndFeels()
,
setLookAndFeel(javax.swing.LookAndFeel)
,
getInstalledLookAndFeels()
public static LookAndFeel[] getAuxiliaryLookAndFeels()
Note these are not the same as the installed look and feels.
addAuxiliaryLookAndFeel(javax.swing.LookAndFeel)
,
removeAuxiliaryLookAndFeel(javax.swing.LookAndFeel)
,
setLookAndFeel(javax.swing.LookAndFeel)
,
getInstalledLookAndFeels()
public static void addPropertyChangeListener(PropertyChangeListener listener)
listener
- The PropertyChangeListener to be addedPropertyChangeSupport
public static void removePropertyChangeListener(PropertyChangeListener listener)
listener
- The PropertyChangeListener to be removedPropertyChangeSupport
|
JavaTM 2 Platform Std. Ed. v1.3.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-2001 Sun Microsystems, Inc. 901 San Antonio Road
Palo Alto, California, 94303, U.S.A. All Rights Reserved.