|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.util.Dictionary<K,V>
java.util.Hashtable<Object,Object>
javax.swing.UIDefaults
public class UIDefaults
UIDefaults is a database where all settings and interface bindings are stored into. A PLAF implementation fills one of these (see for example plaf/basic/BasicLookAndFeel.java) with "ButtonUI" -> new BasicButtonUI().
| Nested Class Summary | |
|---|---|
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
|
| Nested classes/interfaces inherited from interface java.util.Map |
|---|
Map.Entry<K,V> |
| Constructor Summary | |
|---|---|
UIDefaults()
Constructs a new empty UIDefaults instance. |
|
UIDefaults(Object[] entries)
Constructs a new UIDefaults instance and loads the specified entries. |
|
| Method Summary | |
|---|---|
void |
addPropertyChangeListener(PropertyChangeListener listener)
Adds a PropertyChangeListener to this UIDefaults map. |
void |
addResourceBundle(String name)
Adds a ResourceBundle for localized values. |
protected void |
firePropertyChange(String property,
Object oldValue,
Object newValue)
Fires a PropertyChangeEvent. |
Object |
get(Object key)
Returns the entry for the specified key in the default
locale. |
Object |
get(Object key,
Locale loc)
Returns the entry for the specified key in the Locale
loc. |
boolean |
getBoolean(Object key)
Returns a boolean entry for the default locale. |
boolean |
getBoolean(Object key,
Locale locale)
Returns a boolean entry for a specic locale. |
Border |
getBorder(Object key)
Returns a border entry for the default locale. |
Border |
getBorder(Object key,
Locale locale)
Returns a border entry for a specic locale. |
Color |
getColor(Object key)
Returns a color entry for the default locale. |
Color |
getColor(Object key,
Locale locale)
Returns a color entry for a specic locale. |
Locale |
getDefaultLocale()
Returns the current default locale. |
Dimension |
getDimension(Object key)
Returns a dimension entry for the default locale. |
Dimension |
getDimension(Object key,
Locale locale)
Returns a dimension entry for a specic locale. |
Font |
getFont(Object key)
Returns a font entry for the default locale. |
Font |
getFont(Object key,
Locale locale)
Returns a font entry for a specic locale. |
Icon |
getIcon(Object key)
Returns an icon entry for the default locale. |
Icon |
getIcon(Object key,
Locale locale)
Returns an icon entry for a specic locale. |
Insets |
getInsets(Object key)
Returns an insets entry for the default locale. |
Insets |
getInsets(Object key,
Locale locale)
Returns an insets entry for a specic locale. |
int |
getInt(Object key)
Returns an integer entry for the default locale. |
int |
getInt(Object key,
Locale locale)
Returns an integer entry for a specic locale. |
PropertyChangeListener[] |
getPropertyChangeListeners()
Returns an array of all registered PropertyChangeListeners. |
String |
getString(Object key)
Returns a string entry for the default locale. |
String |
getString(Object key,
Locale locale)
Returns a string entry for a specic locale. |
ComponentUI |
getUI(JComponent target)
Returns the ComponentUI for the specified JComponent. |
Class<? extends ComponentUI> |
getUIClass(String id)
Returns the ComponentUI class that renders a component. |
Class<? extends ComponentUI> |
getUIClass(String id,
ClassLoader loader)
Returns the ComponentUI class that renders a component. |
protected void |
getUIError(String msg)
If a key is requested in #get(key) that has no value, this method is called before returning null. |
Object |
put(Object key,
Object value)
Puts a key and value into this UIDefaults object. |
void |
putDefaults(Object[] entries)
Puts a set of key-value pairs into the map. |
void |
removePropertyChangeListener(PropertyChangeListener listener)
Removes a PropertyChangeListener from this UIDefaults map. |
void |
removeResourceBundle(String name)
Removes a ResourceBundle. |
void |
setDefaultLocale(Locale loc)
Sets the current locale to loc. |
| Methods inherited from class java.util.Hashtable |
|---|
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, hashCode, isEmpty, keys, keySet, putAll, rehash, remove, size, toString, values |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public UIDefaults()
public UIDefaults(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 with| Method Detail |
|---|
public Object get(Object key)
key in the default
locale.
get in interface Map<Object,Object>get in class Hashtable<Object,Object>key - the key for which to fetch an associated value
keyHashtable.put(Object, Object),
Hashtable.containsKey(Object)
public Object get(Object key,
Locale loc)
key in the Locale
loc.
key - the key for which we return the valueloc - the locale
public Object put(Object key,
Object value)
Hashtables null-values are accepted
here and treated like #remove(key).
put in interface Map<Object,Object>put in class Hashtable<Object,Object>key - the key to put into the mapvalue - the value to put into the map
null if key
had no value assignedHashtable.get(Object),
Object.equals(Object)public void putDefaults(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 Font getFont(Object key)
key - the key to the requested entry
key or null if no such entry
exists
public Font getFont(Object key,
Locale locale)
key - the key to the requested entrylocale - the locale to the requested entry
key or null if no such entry
existspublic Color getColor(Object key)
key - the key to the requested entry
key or null if no such entry
exists
public Color getColor(Object key,
Locale locale)
key - the key to the requested entrylocale - the locale to the requested entry
key or null if no such entry
existspublic Icon getIcon(Object key)
key - the key to the requested entry
key or null if no such entry
exists
public Icon getIcon(Object key,
Locale locale)
key - the key to the requested entrylocale - the locale to the requested entry
key or null if no such entry
existspublic Border getBorder(Object key)
key - the key to the requested entry
key or null if no such entry
exists
public Border getBorder(Object key,
Locale locale)
key - the key to the requested entrylocale - the locale to the requested entry
key or null if no such entry
existspublic String getString(Object key)
key - the key to the requested entry
key or null if no such entry
exists
public String getString(Object key,
Locale locale)
key - the key to the requested entrylocale - the locale to the requested entry
key or null if no such entry
existspublic int getInt(Object key)
key - the key to the requested entry
key or null if no such entry
exists
public int getInt(Object key,
Locale locale)
key - the key to the requested entrylocale - the locale to the requested entry
key or null if no such entry
existspublic boolean getBoolean(Object key)
key - the key to the requested entry
key or false if no
such entry exists.
public boolean getBoolean(Object key,
Locale locale)
key - the key to the requested entrylocale - the locale to the requested entry
key or null if no such entry
existspublic Insets getInsets(Object key)
key - the key to the requested entry
key or null if no such entry
exists
public Insets getInsets(Object key,
Locale locale)
key - the key to the requested entrylocale - the locale to the requested entry
key or null if no such entry
existspublic Dimension getDimension(Object key)
key - the key to the requested entry
key or null if no such entry
exists
public Dimension getDimension(Object key,
Locale locale)
key - the key to the requested entrylocale - the locale to the requested entry
key or null if no such entry
exists
public Class<? extends ComponentUI> getUIClass(String id,
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 use
idpublic Class<? extends ComponentUI> getUIClass(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 class
idprotected void getUIError(String msg)
null.
msg - the error messagepublic ComponentUI getUI(JComponent target)
ComponentUI for the specified JComponent.
target - the component for which the ComponentUI is requested
ComponentUI for the specified JComponentpublic void addPropertyChangeListener(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(PropertyChangeListener listener)
listener - the PropertyChangeListener to removepublic PropertyChangeListener[] getPropertyChangeListeners()
protected void firePropertyChange(String property,
Object oldValue,
Object newValue)
property - the property nameoldValue - the old valuenewValue - the new valuepublic void addResourceBundle(String name)
name - the name of the ResourceBundle to addpublic void removeResourceBundle(String name)
name - the name of the ResourceBundle to removepublic void setDefaultLocale(Locale loc)
loc.
loc - the Locale to be setpublic Locale getDefaultLocale()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||