|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object![]()
![]()
![]()
java.util.Dictionary
![]()
![]()
<K,V>
java.util.Hashtable
![]()
![]()
<Object
![]()
![]()
,Object
![]()
![]()
>
javax.swing.UIDefaults
, Cloneable
, Map
<Object
,Object
>public class UIDefaults
<Object
,Object
>
A table of defaults for Swing components. Applications can set/get
default values via the UIManager.
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
.
UIManager
,
Serialized Form| Nested Class Summary | |
|---|---|
static interface |
UIDefaults.ActiveValue
This class enables one to store an entry in the defaults table that's constructed each time it's looked up with one of the getXXX(key) methods. |
static class |
UIDefaults.LazyInputMap
LazyInputMap will create a InputMap
in its createValue
method. |
static interface |
UIDefaults.LazyValue
This class enables one to store an entry in the defaults table that isn't constructed until the first time it's looked up with one of the getXXX(key) methods. |
static class |
UIDefaults.ProxyLazyValue
This class provides an implementation of LazyValue
which can be
used to delay loading of the Class for the instance to be created. |
| Constructor Summary | |
|---|---|
UIDefaults
Create an empty defaults table. |
|
UIDefaults
Create a defaults table initialized with the specified key/value pairs. |
|
| Method Summary | |
|---|---|
void |
addPropertyChangeListener
Adds a PropertyChangeListener to the listener list. |
void |
addResourceBundle
Adds a resource bundle to the list of resource bundles that are searched for localized values. |
protected void |
firePropertyChange
Support for reporting bound property changes. |
Object |
get
Returns the value for key. |
Object |
get
Returns the value for key associated with the given locale. |
boolean |
getBoolean
If the value of key is boolean, return the
boolean value, otherwise return false. |
boolean |
getBoolean
If the value of key for the given Locale
is boolean, return the boolean value, otherwise return false. |
Border |
getBorder
If the value of key is a Border return it,
otherwise return null. |
Border |
getBorder
If the value of key for the given Locale
is a Border return it, otherwise return null. |
Color |
getColor
If the value of key is a Color return it,
otherwise return null. |
Color |
getColor
If the value of key for the given Locale
is a Color return it, otherwise return null. |
Locale |
getDefaultLocale
Returns the default locale. |
Dimension |
getDimension
If the value of key is a Dimension return it,
otherwise return null. |
Dimension |
getDimension
If the value of key for the given Locale
is a Dimension return it, otherwise return null. |
Font |
getFont
If the value of key is a Font return it,
otherwise return null. |
Font |
getFont
If the value of key for the given Locale
is a Font return it, otherwise return null. |
Icon |
getIcon
If the value of key is an Icon return it,
otherwise return null. |
Icon |
getIcon
If the value of key for the given Locale
is an Icon return it, otherwise return null. |
Insets |
getInsets
If the value of key is an Insets return it,
otherwise return null. |
Insets |
getInsets
If the value of key for the given Locale
is an Insets return it, otherwise return null. |
int |
getInt
If the value of key is an Integer return its
integer value, otherwise return 0. |
int |
getInt
If the value of key for the given Locale
is an Integer return its integer value, otherwise return 0. |
PropertyChangeListener |
getPropertyChangeListeners
Returns an array of all the PropertyChangeListeners added
to this UIDefaults with addPropertyChangeListener(). |
String |
getString
If the value of key is a String return it,
otherwise return null. |
String |
getString
If the value of key for the given Locale
is a String return it, otherwise return null. |
ComponentUI |
getUI
Creates an ComponentUI implementation for the
specified component. |
Class |
getUIClass
Returns the L&F class that renders this component. |
Class |
getUIClass
The value of get(uidClassID) must be the
String name of a
class that implements the corresponding ComponentUI
class. |
protected void |
getUIError
If getUI() fails for any reason,
it calls this method before returning null. |
Object |
put
Sets the value of key to value for all locales. |
void |
putDefaults
Puts all of the key/value pairs in the database and unconditionally generates one PropertyChangeEvent. |
void |
removePropertyChangeListener
Removes a PropertyChangeListener from the listener list. |
void |
removeResourceBundle
Removes a resource bundle from the list of resource bundles that are searched for localized defaults. |
void |
setDefaultLocale
Sets the default locale. |
Methods inherited from class java.util.Hashtable ![]() |
|---|
clear |
Methods inherited from class java.lang.Object ![]() |
|---|
finalize |
| Constructor Detail |
|---|

public UIDefaults()

public UIDefaults(Object![]()
![]()
[] keyValueList)
Object[] uiDefaults = {
"Font", new Font("Dialog", Font.BOLD, 12),
"Color", Color.red,
"five", new Integer(5)
}
UIDefaults myDefaults = new UIDefaults(uiDefaults);
keyValueList - an array of objects containing the key/value
pairs| Method Detail |
|---|

public Object![]()
![]()
get(Object
![]()
![]()
key)
UIDefaults.LazyValue then the real
value is computed with LazyValue.createValue(),
the table entry is replaced, and the real value is returned.
If the value is an UIDefaults.ActiveValue
the table entry is not replaced - the value is computed
with ActiveValue.createValue() for each
get() call.
If the key is not found in the table then it is searched for in the list
of resource bundles maintained by this object. The resource bundles are
searched most recently added first using the locale returned by
getDefaultLocale. LazyValues and
ActiveValues are not supported in the resource bundles.
get

in interface Map
<Object
,Object
>get

in class Hashtable
<Object
,Object
>key - the desired key
keyUIDefaults.LazyValue
,
UIDefaults.ActiveValue
,
Hashtable.get(java.lang.Object)
,
getDefaultLocale()
,
addResourceBundle(java.lang.String)


public Object![]()
![]()
get(Object
![]()
![]()
key, Locale
![]()
![]()
l)
UIDefaults.LazyValue then the real
value is computed with LazyValue.createValue(),
the table entry is replaced, and the real value is returned.
If the value is an UIDefaults.ActiveValue
the table entry is not replaced - the value is computed
with ActiveValue.c