public class UIDefaults extends java.util.Hashtable<java.lang.Object,java.lang.Object>
| Modifier and Type | Class and Description |
|---|---|
static interface |
UIDefaults.ActiveValue
Used for lazy instantiation of UIDefaults values so that they are not
all loaded when a Swing application starts up, but only the values that
are really needed.
|
static class |
UIDefaults.LazyInputMap |
static interface |
UIDefaults.LazyValue
Used for lazy instantiation of UIDefaults values so that they are not
all loaded when a Swing application starts up, but only the values that
are really needed.
|
static class |
UIDefaults.ProxyLazyValue |
| Constructor and Description |
|---|
UIDefaults()
Constructs a new empty UIDefaults instance.
|
UIDefaults(java.lang.Object[] entries)
Constructs a new UIDefaults instance and loads the specified entries.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a
PropertyChangeListener to this UIDefaults map. |
void |
addResourceBundle(java.lang.String name)
Adds a ResourceBundle for localized values.
|
protected void |
firePropertyChange(java.lang.String property,
java.lang.Object oldValue,
java.lang.Object newValue)
Fires a PropertyChangeEvent.
|
java.lang.Object |
get(java.lang.Object key)
Returns the entry for the specified
key in the default
locale. |
java.lang.Object |
get(java.lang.Object key,
java.util.Locale loc)
Returns the entry for the specified
key in the Locale
loc. |
boolean |
getBoolean(java.lang.Object key)
Returns a boolean entry for the default locale.
|
boolean |
getBoolean(java.lang.Object key,
java.util.Locale locale)
Returns a boolean entry for a specic locale.
|
javax.swing.border.Border |
getBorder(java.lang.Object key)
Returns a border entry for the default locale.
|
javax.swing.border.Border |
getBorder(java.lang.Object key,
java.util.Locale locale)
Returns a border entry for a specic locale.
|
java.awt.Color |
getColor(java.lang.Object key)
Returns a color entry for the default locale.
|
java.awt.Color |
getColor(java.lang.Object key,
java.util.Locale locale)
Returns a color entry for a specic locale.
|
java.util.Locale |
getDefaultLocale()
Returns the current default locale.
|
java.awt.Dimension |
getDimension(java.lang.Object key)
Returns a dimension entry for the default locale.
|
java.awt.Dimension |
getDimension(java.lang.Object key,
java.util.Locale locale)
Returns a dimension entry for a specic locale.
|
java.awt.Font |
getFont(java.lang.Object key)
Returns a font entry for the default locale.
|
java.awt.Font |
getFont(java.lang.Object key,
java.util.Locale locale)
Returns a font entry for a specic locale.
|
Icon |
getIcon(java.lang.Object key)
Returns an icon entry for the default locale.
|
Icon |
getIcon(java.lang.Object key,
java.util.Locale locale)
Returns an icon entry for a specic locale.
|
java.awt.Insets |
getInsets(java.lang.Object key)
Returns an insets entry for the default locale.
|
java.awt.Insets |
getInsets(java.lang.Object key,
java.util.Locale locale)
Returns an insets entry for a specic locale.
|
int |
getInt(java.lang.Object key)
Returns an integer entry for the default locale.
|
int |
getInt(java.lang.Object key,
java.util.Locale locale)
Returns an integer entry for a specic locale.
|
java.beans.PropertyChangeListener[] |
getPropertyChangeListeners()
Returns an array of all registered PropertyChangeListeners.
|
java.lang.String |
getString(java.lang.Object key)
Returns a string entry for the default locale.
|
java.lang.String |
getString(java.lang.Object key,
java.util.Locale locale)
Returns a string entry for a specic locale.
|
javax.swing.plaf.ComponentUI |
getUI(JComponent target)
Returns the
ComponentUI for the specified JComponent. |
java.lang.Class<? extends javax.swing.plaf.ComponentUI> |
getUIClass(java.lang.String id)
Returns the ComponentUI class that renders a component.
|
java.lang.Class<? extends javax.swing.plaf.ComponentUI> |
getUIClass(java.lang.String id,
java.lang.ClassLoader loader)
Returns the ComponentUI class that renders a component.
|
protected void |
getUIError(java.lang.String msg)
If a key is requested in #get(key) that has no value, this method
is called before returning
null. |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
Puts a key and value into this UIDefaults object.
|
void |
putDefaults(java.lang.Object[] entries)
Puts a set of key-value pairs into the map.
|
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a PropertyChangeListener from this UIDefaults map.
|
void |
removeResourceBundle(java.lang.String name)
Removes a ResourceBundle.
|
void |
setDefaultLocale(java.util.Locale loc)
Sets the current locale to
loc. |
public UIDefaults()
public UIDefaults(java.lang.Object[] entries)
entries[0] is a key, entries[1] is a value,
entries[2] a key and so forth.entries - the entries to initialize the UIDefaults instance withpublic java.lang.Object get(java.lang.Object key)
key in the default
locale.get in interface java.util.Map<java.lang.Object,java.lang.Object>get in class java.util.Hashtable<java.lang.Object,java.lang.Object>key - the key for which to fetch an associated valuekeyHashtable.put(Object, Object),
Hashtable.containsKey(Object)public java.lang.Object get(java.lang.Object key, java.util.Locale loc)
key in the Locale
loc.key - the key for which we return the valueloc - the localepublic java.lang.Object put(java.lang.Object key, java.lang.Object value)
Hashtables null-values are accepted
here and treated like #remove(key).
put in interface java.util.Map<java.lang.Object,java.lang.Object>put in class java.util.Hashtable<java.lang.Object,java.lang.Object>key - the key to put into the mapvalue - the value to put into the mapnull if key
had no value assignedHashtable.get(Object),
Object.equals(Object)public void putDefaults(java.lang.Object[] entries)
entries[0] is a key, entries[1] is a value,
entries[2] a key and so forth.
null it is treated like #remove(key).
'UIDefaults' as name and null for
old and new value.entries - the entries to be put into the mappublic java.awt.Font getFont(java.lang.Object key)
key - the key to the requested entrykey or null if no such entry
existspublic java.awt.Font getFont(java.lang.Object key, java.util.Locale locale)
key - the key to the requested entrylocale - the locale to the requested entrykey or null if no such entry
existspublic java.awt.Color getColor(java.lang.Object key)
key - the key to the requested entrykey or null if no such entry
existspublic java.awt.Color getColor(java.lang.Object key, java.util.Locale locale)
key - the key to the requested entrylocale - the locale to the requested entrykey or null if no such entry
existspublic Icon getIcon(java.lang.Object key)
key - the key to the requested entrykey or null if no such entry
existspublic Icon getIcon(java.lang.Object key, java.util.Locale locale)
key - the key to the requested entrylocale - the locale to the requested entrykey or null if no such entry
existspublic javax.swing.border.Border getBorder(java.lang.Object key)
key - the key to the requested entrykey or null if no such entry
existspublic javax.swing.border.Border getBorder(java.lang.Object key, java.util.Locale locale)
key - the key to the requested entrylocale - the locale to the requested entrykey or null if no such entry
existspublic java.lang.String getString(java.lang.Object key)
key - the key to the requested entrykey or null if no such entry
existspublic java.lang.String getString(java.lang.Object key, java.util.Locale locale)
key - the key to the requested entrylocale - the locale to the requested entrykey or null if no such entry
existspublic int getInt(java.lang.Object key)
key - the key to the requested entrykey or null if no such entry
existspublic int getInt(java.lang.Object key, java.util.Locale locale)
key - the key to the requested entrylocale - the locale to the requested entrykey or null if no such entry
existspublic boolean getBoolean(java.lang.Object key)
key - the key to the requested entrykey or false if no
such entry exists.public boolean getBoolean(java.lang.Object key, java.util.Locale locale)
key - the key to the requested entrylocale - the locale to the requested entrykey or null if no such entry
existspublic java.awt.Insets getInsets(java.lang.Object key)
key - the key to the requested entrykey or null if no such entry
existspublic java.awt.Insets getInsets(java.lang.Object key, java.util.Locale locale)
key - the key to the requested entrylocale - the locale to the requested entrykey or null if no such entry
existspublic java.awt.Dimension getDimension(java.lang.Object key)
key - the key to the requested entrykey or null if no such entry
existspublic java.awt.Dimension getDimension(java.lang.Object key, java.util.Locale locale)
key - the key to the requested entrylocale - the locale to the requested entrykey or null if no such entry
existspublic java.lang.Class<? extends javax.swing.plaf.ComponentUI> getUIClass(java.lang.String id, java.lang.ClassLoader loader)
id
is the ID for which the String value of the classname is stored in
this UIDefaults map.id - the ID of the UI classloader - the ClassLoader to useidpublic java.lang.Class<? extends javax.swing.plaf.ComponentUI> getUIClass(java.lang.String id)
id
is the ID for which the String value of the classname is stored in
this UIDefaults map.id - the ID of the UI classidprotected void getUIError(java.lang.String msg)
null.msg - the error messagepublic javax.swing.plaf.ComponentUI getUI(JComponent target)
ComponentUI for the specified JComponent.target - the component for which the ComponentUI is requestedComponentUI for the specified JComponentpublic void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
PropertyChangeListener to this UIDefaults map.
Registered PropertyChangeListener are notified when values
are beeing put into this UIDefaults map.listener - the PropertyChangeListener to addpublic void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
listener - the PropertyChangeListener to removepublic java.beans.PropertyChangeListener[] getPropertyChangeListeners()
protected void firePropertyChange(java.lang.String property, java.lang.Object oldValue, java.lang.Object newValue)
property - the property nameoldValue - the old valuenewValue - the new valuepublic void addResourceBundle(java.lang.String name)
name - the name of the ResourceBundle to addpublic void removeResourceBundle(java.lang.String name)
name - the name of the ResourceBundle to removepublic void setDefaultLocale(java.util.Locale loc)
loc.loc - the Locale to be setpublic java.util.Locale getDefaultLocale()