|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object![]()
![]()
![]()
javax.swing.UIManager

public class 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:
swing.defaultlaf is
non-null, use it as the default look and feel class name.
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 XMLEncoder
.
javax.swing.plaf.metal,
Serialized Form| 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
Adds a LookAndFeel to the list of auxiliary look and feels. |
static void |
addPropertyChangeListener
Adds a PropertyChangeListener to the listener list. |
static Object |
get
Returns an object from the defaults table. |
static Object |
get
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
Returns a boolean from the defaults table which is associated with the key value. |
static boolean |
getBoolean
Returns a boolean from the defaults table which is associated with the key value and the given Locale. |
static Border |
getBorder
Returns a border from the defaults table. |
static Border |
getBorder
Returns a border from the defaults table that is appropriate for the given locale. |
static Color |
getColor
Returns a drawing color from the defaults table. |
static Color |
getColor
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
Returns a dimension from the defaults table. |
static Dimension |
getDimension
Returns a dimension from the defaults table that is appropriate for the given locale. |
static Font |
getFont
Returns a drawing font from the defaults table. |
static Font |
getFont
Returns a drawing font from the defaults table that is appropriate for the given locale. |
static Icon |
getIcon
Returns an Icon from the defaults table. |
static Icon |
getIcon
Returns an Icon from the defaults table that is appropriate
for the given locale. |
static Insets |
getInsets
Returns an Insets object from the defaults table. |
static Insets |
getInsets
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
Returns an integer from the defaults table. |
static int |
getInt
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
Returns a string from the defaults table. |
static String |
getString
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
Returns the L&F object that renders the target component. |
static void |
installLookAndFeel
Creates a new look and feel and adds it to the current array. |
static void |
installLookAndFeel
Adds the specified look and feel to the current array and then calls setInstalledLookAndFeels(javax.swing.UIManager.LookAndFeelInfo[]) . |
static Object |
put
Stores an object in the defaults table. |
static boolean |
removeAuxiliaryLookAndFeel
Removes a LookAndFeel from the list of auxiliary look and feels. |
static void |
removePropertyChangeListener
Removes a PropertyChangeListener from the listener list. |
static void |
setInstalledLookAndFeels
Replaces the current array of installed LookAndFeelInfos. |
static void |
setLookAndFeel
Sets the current default look and feel using a LookAndFeel object. |
static void |
setLookAndFeel
Sets the current default look and feel using a class name. |
Methods inherited from class java.lang.Object ![]() |
|---|
clone |
| Constructor Detail |
|---|

public UIManager()
| Method Detail |
|---|

public static 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(UIManager.LookAndFeelInfo![]()
![]()
[] infos) throws SecurityException
![]()
![]()
LookAndFeelInfos.
infos - new array of LookAndFeelInfo objects
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 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 feel

public 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
UnsupportedLookAndFeelException

- if
lnf.isSupportedLookAndFeel() is falsegetLookAndFeel()


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

- if the LookAndFeel
class could not be found
InstantiationException

- if a new instance of the class
couldn't be created
IllegalAccessException

- if the class or initializer isn't accessible
UnsupportedLookAndFeelException

- if
lnf.isSupportedLookAndFeel() is false

public 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. If the system property swing.systemlaf has been
defined, its value will be returned.
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). If the system property
swing.crossplatformlaf has been
defined, its value will be returned.
setLookAndFeel(javax.swing.LookAndFeel)
,
getSystemLookAndFeelClassName()


public static UIDefaults![]()
![]()
getDefaults()
UIDefaults object containing the default values

public 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 object

public 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 object

public 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 object

public static Border![]()
![]()
getBorder(Object
![]()
![]()
key)
key - an Object specifying the border
Border object

public static Border![]()
![]()
getBorder(Object
![]()
![]()
key, Locale
![]()
![]()
l)
key - an Object specifying the borderl - the Locale for which the border is desired
Border object

public 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

public 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

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 object

public 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 object

public 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 ComponentUI![]()
![]()
getUI(JComponent
![]()
![]()
target)
target - the JComponent to render
ComponentUI object that renders the target component

public static UIDefaults![]()
![]()
getLookAndFeelDefaults()
UIDefaults object containing the default values

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(PropertyChangeListener![]()
![]()
listener)
PropertyChangeListener to the listener list.
The listener is registered for all properties.
listener - the PropertyChangeListener to be addedPropertyChangeSupport


public static void removePropertyChangeListener(PropertyChangeListener![]()
![]()
listener)
PropertyChangeListener from the listener list.
This removes a PropertyChangeListener that was registered
for all properties.
listener - the PropertyChangeListener to be removedPropertyChangeSupport


public static PropertyChangeListener![]()
![]()
[] getPropertyChangeListeners()
PropertyChangeListeners added
to this UIManager with addPropertyChangeListener().
PropertyChangeListeners added or an empty
array if no listeners have been added
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||