Class UIDefaults
- All Implemented Interfaces:
Serializable
,Cloneable
,Map<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 JavaBeans
has been added to the java.beans
package.
Please see XMLEncoder
.
- Since:
- 1.2
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
This class enables one to store an entry in the defaults table that's constructed each time it's looked up with one of thegetXXX(key)
methods.static class
LazyInputMap
will create aInputMap
in itscreateValue
method.static interface
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 thegetXXX(key)
methods.static class
This class provides an implementation ofLazyValue
which can be used to delay loading of the Class for the instance to be created. -
Constructor Summary
ConstructorsConstructorDescriptionCreates an empty defaults table.UIDefaults
(int initialCapacity, float loadFactor) Creates an empty defaults table with the specified initial capacity and load factor.UIDefaults
(Object[] keyValueList) Creates a defaults table initialized with the specified key/value pairs. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds aPropertyChangeListener
to the listener list.void
addResourceBundle
(String bundleName) Adds a resource bundle to the list of resource bundles that are searched for localized values.protected void
firePropertyChange
(String propertyName, Object oldValue, Object newValue) Support for reporting bound property changes.Returns the value for key.Returns the value for key associated with the given locale.boolean
getBoolean
(Object key) If the value ofkey
is boolean, return the boolean value, otherwise return false.boolean
getBoolean
(Object key, Locale l) If the value ofkey
for the givenLocale
is boolean, return the boolean value, otherwise return false.If the value ofkey
is aBorder
return it, otherwise returnnull
.If the value ofkey
for the givenLocale
is aBorder
return it, otherwise returnnull
.If the value ofkey
is aColor
return it, otherwise returnnull
.If the value ofkey
for the givenLocale
is aColor
return it, otherwise returnnull
.Returns the default locale.getDimension
(Object key) If the value ofkey
is aDimension
return it, otherwise returnnull
.getDimension
(Object key, Locale l) If the value ofkey
for the givenLocale
is aDimension
return it, otherwise returnnull
.If the value ofkey
is aFont
return it, otherwise returnnull
.If the value ofkey
for the givenLocale
is aFont
return it, otherwise returnnull
.If the value ofkey
is anIcon
return it, otherwise returnnull
.If the value ofkey
for the givenLocale
is anIcon
return it, otherwise returnnull
.If the value ofkey
is anInsets
return it, otherwise returnnull
.If the value ofkey
for the givenLocale
is anInsets
return it, otherwise returnnull
.int
If the value ofkey
is anInteger
return its integer value, otherwise return 0.int
If the value ofkey
for the givenLocale
is anInteger
return its integer value, otherwise return 0.Returns an array of all thePropertyChangeListener
s added to this UIDefaults with addPropertyChangeListener().If the value ofkey
is aString
return it, otherwise returnnull
.If the value ofkey
for the givenLocale
is aString
return it, otherwise returnnull
.getUI
(JComponent target) Creates anComponentUI
implementation for the specified component.Class
<? extends ComponentUI> getUIClass
(String uiClassID) Returns the L&F class that renders this component.Class
<? extends ComponentUI> getUIClass
(String uiClassID, ClassLoader uiClassLoader) The value ofget(uidClassID)
must be theString
name of a class that implements the correspondingComponentUI
class.protected void
getUIError
(String msg) IfgetUI()
fails for any reason, it calls this method before returningnull
.Sets the value ofkey
tovalue
for all locales.void
putDefaults
(Object[] keyValueList) Puts all of the key/value pairs in the database and unconditionally generates onePropertyChangeEvent
.void
Removes aPropertyChangeListener
from the listener list.void
removeResourceBundle
(String bundleName) Removes a resource bundle from the list of resource bundles that are searched for localized defaults.void
Sets the default locale.