|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--javax.swing.UIManager
Unsafe: 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:
swing.defaultlaf is
non-null, use it as the default look and feel class name.
java.util.Properties file swing.properties
exists and contains the key swing.defaultlaf,
use its value as default look and feel class name. The location of
swing.properties may vary depending upon the
implementation of the Java platform. In Sun's implementation
this will reside in
&java.home>/lib/swing.properties. Refer to
the release notes of the implementation you are using for
further details.
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 JavaBeansTM
has been added to the java.beans package.
Please see java.beans.XMLEncoder.
javax.swing.plaf.metal,
Serialized Form| Field Summary | |
private static String |
auxiliaryLAFsKey
|
private static Object |
classLock
|
private static javax.swing.UIManager.LAFState |
currentLAFState
|
private static Thread |
currentLAFStateThread
|
private static String |
defaultLAFKey
|
private static String |
disableMnemonicKey
|
private static javax.swing.UIManager.LookAndFeelInfo[] |
installedLAFs
The default value of installedLAFS is used when no
swing.properties
file is available or if the file doesn't contain a "swing.installedlafs"
property. |
private static String |
installedLAFsKey
|
private static Object |
lafStateACKey
The AppContext key for our one LAFState instance. |
private static String |
multiplexingLAFKey
|
| Constructor Summary | |
UIManager()
Suppressed: |
|
| Method Summary | |
static void |
addAuxiliaryLookAndFeel(LookAndFeel laf)
Suppressed: Adds a LookAndFeel to the list of auxiliary look and feels. |
static void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Suppressed: Adds a PropertyChangeListener to the listener list. |
private static void |
checkProperty(Properties props,
String key)
|
static Object |
get(Object key)
Suppressed: Returns an object from the defaults table. |
static Object |
get(Object key,
Locale l)
Suppressed: Returns an object from the defaults table that is appropriate for the given locale. |
static LookAndFeel[] |
getAuxiliaryLookAndFeels()
Suppressed: Returns the list of auxiliary look and feels (can be null). |
static boolean |
getBoolean(Object key)
Suppressed: Returns a boolean from the defaults table which is associated with the key value. |
static boolean |
getBoolean(Object key,
Locale l)
Suppressed: Returns a boolean from the defaults table which is associated with the key value and the given Locale. |
static javax.swing.border.Border |
getBorder(Object key)
Suppressed: Returns a border from the defaults table. |
static javax.swing.border.Border |
getBorder(Object key,
Locale l)
Suppressed: Returns a border from the defaults table that is appropriate for the given locale. |
static Color |
getColor(Object key)
Suppressed: Returns a drawing color from the defaults table. |
static Color |
getColor(Object key,
Locale l)
Suppressed: Returns a drawing color from the defaults table that is appropriate for the given locale. |
static String |
getCrossPlatformLookAndFeelClassName()
Suppressed: 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()
Suppressed: Returns the default values for this look and feel. |
static Dimension |
getDimension(Object key)
Suppressed: Returns a dimension from the defaults table. |
static Dimension |
getDimension(Object key,
Locale l)
Suppressed: Returns a dimension from the defaults table that is appropriate for the given locale. |
static Font |
getFont(Object key)
Suppressed: Returns a drawing font from the defaults table. |
static Font |
getFont(Object key,
Locale l)
Suppressed: Returns a drawing font from the defaults table that is appropriate for the given locale. |
static Icon |
getIcon(Object key)
Suppressed: Returns an Icon from the defaults table. |
static Icon |
getIcon(Object key,
Locale l)
Suppressed: Returns an Icon from the defaults table that is appropriate
for the given locale. |
static Insets |
getInsets(Object key)
Suppressed: Returns an Insets object from the defaults table. |
static Insets |
getInsets(Object key,
Locale l)
Suppressed: Returns an Insets object from the defaults table that is
appropriate for the given locale. |
static javax.swing.UIManager.LookAndFeelInfo[] |
getInstalledLookAndFeels()
Suppressed: 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)
Suppressed: Returns an integer from the defaults table. |
(package private) static int |
getInt(Object key,
int defaultValue)
Returns an integer from the defaults table. |
static int |
getInt(Object key,
Locale l)
Suppressed: Returns an integer from the defaults table that is appropriate for the given locale. |
private static javax.swing.UIManager.LAFState |
getLAFState()
Return the LAFState object, lazily create one if necessary. |
static LookAndFeel |
getLookAndFeel()
Suppressed: Returns the current default look and feel or null. |
static UIDefaults |
getLookAndFeelDefaults()
Suppressed: Returns the default values for this look and feel. |
private static LookAndFeel |
getMultiLookAndFeel()
Finds the Multiplexing LookAndFeel. |
static java.beans.PropertyChangeListener[] |
getPropertyChangeListeners()
Suppressed: Returns an array of all the PropertyChangeListeners added
to this UIManager with addPropertyChangeListener(). |
static String |
getString(Object key)
Suppressed: Returns a string from the defaults table. |
(package private) static String |
getString(Object key,
Component c)
Returns a string from the defaults table that is appropriate for the given locale. |
static String |
getString(Object key,
Locale l)
Suppressed: Returns a string from the defaults table that is appropriate for the given locale. |
static String |
getSystemLookAndFeelClassName()
Suppressed: 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 javax.swing.plaf.ComponentUI |
getUI(JComponent target)
Suppressed: Returns the L&F object that renders the target component. |
private static void |
initialize()
|
private static void |
initializeAuxiliaryLAFs(Properties swingProps)
|
private static void |
initializeDefaultLAF(Properties swingProps)
If the user has specified a default look and feel, use that. |
private static void |
initializeInstalledLAFs(Properties swingProps)
If a swing.properties file exist and it has a swing.installedlafs property then initialize the installedLAFs field. |
private static void |
initializeSystemDefaults(Properties swingProps)
|
static void |
installLookAndFeel(String name,
String className)
Suppressed: Creates a new look and feel and adds it to the current array. |
static void |
installLookAndFeel(javax.swing.UIManager.LookAndFeelInfo info)
Suppressed: Adds the specified look and feel to the current array and then calls setInstalledLookAndFeels(javax.swing.UIManager.LookAndFeelInfo[]). |
private static Properties |
loadSwingProperties()
|
private static String |
makeInstalledLAFKey(String laf,
String attr)
Return a swing.properties file key for the attribute of specified look and feel. |
private static String |
makeSwingPropertiesFilename()
The filename for swing.properties is a path like this (Unix version): |
private static void |
maybeInitialize()
|
static Object |
put(Object key,
Object value)
Suppressed: Stores an object in the defaults table. |
static boolean |
removeAuxiliaryLookAndFeel(LookAndFeel laf)
Suppressed: Removes a LookAndFeel from the list of auxiliary look and feels. |
static void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Suppressed: Removes a PropertyChangeListener from the listener list. |
static void |
setInstalledLookAndFeels(javax.swing.UIManager.LookAndFeelInfo[] infos)
Suppressed: Replaces the current array of installed LookAndFeelInfos. |
static void |
setLookAndFeel(LookAndFeel newLookAndFeel)
Suppressed: Sets the current default look and feel using a LookAndFeel object. |
static void |
setLookAndFeel(String className)
Suppressed: 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 |
| Field Detail |
private static final Object lafStateACKey
AppContext key for our one LAFState instance.
private static final Object classLock
private static Thread currentLAFStateThread
private static javax.swing.UIManager.LAFState currentLAFState
private static final String defaultLAFKey
private static final String auxiliaryLAFsKey
private static final String multiplexingLAFKey
private static final String installedLAFsKey
private static final String disableMnemonicKey
private static javax.swing.UIManager.LookAndFeelInfo[] installedLAFs
installedLAFS is used when no
swing.properties
file is available or if the file doesn't contain a "swing.installedlafs"
property.
initializeInstalledLAFs(java.util.Properties)| Constructor Detail |
public UIManager()
| Method Detail |
private static javax.swing.UIManager.LAFState getLAFState()
LAFState object, lazily create one if necessary.
All access to the LAFState fields is done via this method,
for example:
getLAFState().initialized = true;
private static String makeInstalledLAFKey(String laf,
String attr)
private static String makeSwingPropertiesFilename()
public static javax.swing.UIManager.LookAndFeelInfo[] getInstalledLookAndFeels()
LookAndFeel implementations that have been installed with this
software development kit. The LookAndFeel info objects can
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());
LookAndFeelInfo objectssetLookAndFeel(javax.swing.LookAndFeel)
public static void setInstalledLookAndFeels(javax.swing.UIManager.LookAndFeelInfo[] infos)
throws SecurityException
LookAndFeelInfos.
infos - new array of LookAndFeelInfo objects
SecurityExceptiongetInstalledLookAndFeels()public static void installLookAndFeel(javax.swing.UIManager.LookAndFeelInfo info)
setInstalledLookAndFeels(javax.swing.UIManager.LookAndFeelInfo[]).
info - a LookAndFeelInfo object that names the
look and feel and identifies that class that implements it
public 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()
null.
nullsetLookAndFeel(javax.swing.LookAndFeel)
public static void setLookAndFeel(LookAndFeel newLookAndFeel)
throws UnsupportedLookAndFeelException
LookAndFeel object.
This is a JavaBeans bound property.
newLookAndFeel - the LookAndFeel object
UnsupportedLookAndFeelExceptiongetLookAndFeel()
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 feel
ClassNotFoundException
InstantiationException
IllegalAccessException
UnsupportedLookAndFeelExceptionpublic static String getSystemLookAndFeelClassName()
LookAndFeel class that implements
the native systems look and feel if there is one, otherwise
the name of the default cross platform LookAndFeel
class.
String of the LookAndFeel
classsetLookAndFeel(javax.swing.LookAndFeel),
getCrossPlatformLookAndFeelClassName()public static String getCrossPlatformLookAndFeelClassName()
LookAndFeel class that implements
the default cross platform look and feel -- the Java
Look and Feel (JLF).
setLookAndFeel(javax.swing.LookAndFeel),
getSystemLookAndFeelClassName()public static UIDefaults getDefaults()
UIDefaults object containing the default valuespublic static Font getFont(Object key)
key - an Object specifying the font
Font object
public static Font getFont(Object key,
Locale l)
key - an Object specifying the fontl - the Locale for which the font is desired
Font objectpublic static Color getColor(Object key)
key - an Object specifying the color
Color object
public static Color getColor(Object key,
Locale l)
key - an Object specifying the colorl - the Locale for which the color is desired
Color objectpublic static Icon getIcon(Object key)
Icon from the defaults table.
key - an Object specifying the icon
Icon object
public static Icon getIcon(Object key,
Locale l)
Icon from the defaults table that is appropriate
for the given locale.
key - an Object specifying the iconl - the Locale for which the icon is desired
Icon objectpublic static javax.swing.border.Border getBorder(Object key)
key - an Object specifying the border
Border object
public static javax.swing.border.Border getBorder(Object key,
Locale l)
key - an Object specifying the borderl - the Locale for which the border is desired
Border objectpublic static String getString(Object key)
key - an Object specifying the string
String
public static String getString(Object key,
Locale l)
key - an Object specifying the stringl - the Locale for which the string is desired
String
static String getString(Object key,
Component c)
key - an Object specifying the stringc - Component used to determine Locale, null implies use the
default Locale.
Stringpublic static int getInt(Object key)
key - an Object specifying the int
public static int getInt(Object key,
Locale l)
key - an Object specifying the intl - the Locale for which the int is desired
static int getInt(Object key,
int defaultValue)
key does
not map to a valid Integer, or can not be convered from
a String to an integer, default is
returned.
key - an Object specifying the intdefaultValue - Returned value if key is not available,
or is not an Integer
public static boolean getBoolean(Object key)
key - an Object specifying the key for the desired boolean value
public static boolean getBoolean(Object key,
Locale l)
Locale. If the key is not
found or the key doesn't represent
a boolean value then false will be returned.
key - an Object specifying the key for the desired
boolean valuel - the Locale for which the boolean is desired
public static Insets getInsets(Object key)
Insets object from the defaults table.
key - an Object specifying the Insets object
Insets object
public static Insets getInsets(Object key,
Locale l)
Insets object from the defaults table that is
appropriate for the given locale.
key - an Object specifying the Insets objectl - the Locale for which the object is desired
Insets objectpublic static Dimension getDimension(Object key)
key - an Object specifying the dimension object
Dimension object
public static Dimension getDimension(Object key,
Locale l)
key - an Object specifying the dimension objectl - the Locale for which the object is desired
Dimension objectpublic static Object get(Object key)
key - an Object specifying the desired object
Object
public static Object get(Object key,
Locale l)
key - an Object specifying the desired objectl - the Locale for which the object is desired
Object
public static Object put(Object key,
Object value)
key - an Object specifying the retrieval keyvalue - the Object to store
Object returned by UIDefaults.put(java.lang.Object, java.lang.Object)public static javax.swing.plaf.ComponentUI getUI(JComponent target)
target - the JComponent to render
ComponentUI object that renders the target componentpublic static UIDefaults getLookAndFeelDefaults()
UIDefaults object containing the default valuesprivate static LookAndFeel getMultiLookAndFeel()
LookAndFeel.
public static void addAuxiliaryLookAndFeel(LookAndFeel laf)
LookAndFeel to the list of auxiliary look and feels.
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. The change will only take effect when a new
UI class is created or when the default look and feel is changed
on a component instance.
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)
LookAndFeel from the list of auxiliary look and feels.
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. The change will only take effect when a new
UI class is created or when the default look and feel is changed
on a component instance.
Note these are not the same as the installed look and feels.
LookAndFeel was removed from the listremoveAuxiliaryLookAndFeel(javax.swing.LookAndFeel),
getAuxiliaryLookAndFeels(),
setLookAndFeel(javax.swing.LookAndFeel),
getInstalledLookAndFeels()public static LookAndFeel[] getAuxiliaryLookAndFeels()
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.
LookAndFeels or nulladdAuxiliaryLookAndFeel(javax.swing.LookAndFeel),
removeAuxiliaryLookAndFeel(javax.swing.LookAndFeel),
setLookAndFeel(javax.swing.LookAndFeel),
getInstalledLookAndFeels()public static void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
PropertyChangeListener to the listener list.
The listener is registered for all properties.
listener - the PropertyChangeListener to be addedjava.beans.PropertyChangeSupportpublic static void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
PropertyChangeListener from the listener list.
This removes a PropertyChangeListener that was registered
for all properties.
listener - the PropertyChangeListener to be removedjava.beans.PropertyChangeSupportpublic static java.beans.PropertyChangeListener[] getPropertyChangeListeners()
PropertyChangeListeners added
to this UIManager with addPropertyChangeListener().
PropertyChangeListeners added or an empty
array if no listeners have been addedprivate static Properties loadSwingProperties()
private static void checkProperty(Properties props,
String key)
private static void initializeInstalledLAFs(Properties swingProps)
installedLAFs field.
getInstalledLookAndFeels()private static void initializeDefaultLAF(Properties swingProps)
maybeInitialize()private static void initializeAuxiliaryLAFs(Properties swingProps)
private static void initializeSystemDefaults(Properties swingProps)
private static void maybeInitialize()
private static void initialize()
|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||