UIDefaults (Java SE 15 & JDK 15) (original) (raw)

All Implemented Interfaces:

[Serializable](../../../java.base/java/io/Serializable.html "interface in java.io"), [Cloneable](../../../java.base/java/lang/Cloneable.html "interface in java.lang"), [Map](../../../java.base/java/util/Map.html "interface in java.util")<[Object](../../../java.base/java/lang/Object.html "class in java.lang"),​[Object](../../../java.base/java/lang/Object.html "class in java.lang")>


public class UIDefaults extends Hashtable<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:

UIManager

Nested Classes

Modifier and Type Class Description
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.

Constructors

Constructor Description
UIDefaults() Creates 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.
Modifier and Type Method Description
void addPropertyChangeListener​(PropertyChangeListener listener) Adds a PropertyChangeListener 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.
Object get​(Object key) Returns the value for key.
Object get​(Object key,Locale l) Returns the value for key associated with the given locale.
boolean getBoolean​(Object key) If the value of key is boolean, return the boolean value, otherwise return false.
boolean getBoolean​(Object key,Locale l) If the value of key for the given Locale is boolean, return the boolean value, otherwise return false.
Border getBorder​(Object key) If the value of key is a Border return it, otherwise return null.
Border getBorder​(Object key,Locale l) If the value of key for the given Locale is a Border return it, otherwise return null.
Color getColor​(Object key) If the value of key is a Color return it, otherwise return null.
Color getColor​(Object key,Locale l) 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​(Object key) If the value of key is a Dimension return it, otherwise return null.
Dimension getDimension​(Object key,Locale l) If the value of key for the given Locale is a Dimension return it, otherwise return null.
Font getFont​(Object key) If the value of key is a Font return it, otherwise return null.
Font getFont​(Object key,Locale l) If the value of key for the given Locale is a Font return it, otherwise return null.
Icon getIcon​(Object key) If the value of key is an Icon return it, otherwise return null.
Icon getIcon​(Object key,Locale l) If the value of key for the given Locale is an Icon return it, otherwise return null.
Insets getInsets​(Object key) If the value of key is an Insets return it, otherwise return null.
Insets getInsets​(Object key,Locale l) If the value of key for the given Locale is an Insets return it, otherwise return null.
int getInt​(Object key) If the value of key is an Integer return its integer value, otherwise return 0.
int getInt​(Object key,Locale l) 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​(Object key) If the value of key is a String return it, otherwise return null.
String getString​(Object key,Locale l) If the value of key for the given Locale is a String return it, otherwise return null.
ComponentUI getUI​(JComponent target) Creates an ComponentUI 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 of get(uidClassID) must be theString name of a class that implements the corresponding ComponentUI class.
protected void getUIError​(String msg) If getUI() fails for any reason, it calls this method before returning null.
Object put​(Object key,Object value) Sets the value of key to value for all locales.
void putDefaults​(Object[] keyValueList) Puts all of the key/value pairs in the database and unconditionally generates one PropertyChangeEvent.
void removePropertyChangeListener​(PropertyChangeListener listener) Removes a PropertyChangeListener 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 setDefaultLocale​(Locale l) Sets the default locale.

Methods declared in class java.util.Hashtable

[clear](../../../java.base/java/util/Hashtable.html#clear%28%29), [clone](../../../java.base/java/util/Hashtable.html#clone%28%29), [compute](../../../java.base/java/util/Hashtable.html#compute%28K,java.util.function.BiFunction%29), [computeIfAbsent](../../../java.base/java/util/Hashtable.html#computeIfAbsent%28K,java.util.function.Function%29), [computeIfPresent](../../../java.base/java/util/Hashtable.html#computeIfPresent%28K,java.util.function.BiFunction%29), [contains](../../../java.base/java/util/Hashtable.html#contains%28java.lang.Object%29), [containsKey](../../../java.base/java/util/Hashtable.html#containsKey%28java.lang.Object%29), [containsValue](../../../java.base/java/util/Hashtable.html#containsValue%28java.lang.Object%29), [elements](../../../java.base/java/util/Hashtable.html#elements%28%29), [entrySet](../../../java.base/java/util/Hashtable.html#entrySet%28%29), [equals](../../../java.base/java/util/Hashtable.html#equals%28java.lang.Object%29), [hashCode](../../../java.base/java/util/Hashtable.html#hashCode%28%29), [isEmpty](../../../java.base/java/util/Hashtable.html#isEmpty%28%29), [keys](../../../java.base/java/util/Hashtable.html#keys%28%29), [keySet](../../../java.base/java/util/Hashtable.html#keySet%28%29), [merge](../../../java.base/java/util/Hashtable.html#merge%28K,V,java.util.function.BiFunction%29), [putAll](../../../java.base/java/util/Hashtable.html#putAll%28java.util.Map%29), [rehash](../../../java.base/java/util/Hashtable.html#rehash%28%29), [remove](../../../java.base/java/util/Hashtable.html#remove%28java.lang.Object%29), [size](../../../java.base/java/util/Hashtable.html#size%28%29), [toString](../../../java.base/java/util/Hashtable.html#toString%28%29), [values](../../../java.base/java/util/Hashtable.html#values%28%29)