|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--java.util.Dictionary
|
+--java.util.Hashtable
|
+--javax.swing.UIDefaults
Unsafe:
| Field Summary | |
private SwingPropertyChangeSupport |
changeSupport
|
private Locale |
defaultLocale
|
private static Object |
PENDING
|
private Vector |
resourceBundles
|
private Map |
resourceCache
Maps from a Locale to a cached Map of the ResourceBundle. |
| Fields inherited from class java.util.Hashtable |
|
| Constructor Summary | |
UIDefaults()
Suppressed: Create an empty defaults table. |
|
UIDefaults(Object[] keyValueList)
Suppressed: Create a defaults table initialized with the specified key/value pairs. |
|
| Method Summary | |
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Suppressed: Adds a PropertyChangeListener to the listener list. |
void |
addResourceBundle(String bundleName)
Suppressed: 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)
Suppressed: Returns the value for key. |
Object |
get(Object key,
Locale l)
Suppressed: Returns the value for key associated with the given locale. |
boolean |
getBoolean(Object key)
Suppressed: If the value of key is boolean, return the
boolean value, otherwise return false. |
boolean |
getBoolean(Object key,
Locale l)
Suppressed: If the value of key for the given Locale
is boolean, return the boolean value, otherwise return false. |
javax.swing.border.Border |
getBorder(Object key)
Suppressed: If the value of key is a Border return it,
otherwise return null. |
javax.swing.border.Border |
getBorder(Object key,
Locale l)
Suppressed: If the value of key for the given Locale
is a Border return it, otherwise return null. |
Color |
getColor(Object key)
Suppressed: If the value of key is a Color return it,
otherwise return null. |
Color |
getColor(Object key,
Locale l)
Suppressed: If the value of key for the given Locale
is a Color return it, otherwise return null. |
Locale |
getDefaultLocale()
Suppressed: Returns the default locale. |
Dimension |
getDimension(Object key)
Suppressed: If the value of key is a Dimension return it,
otherwise return null. |
Dimension |
getDimension(Object key,
Locale l)
Suppressed: If the value of key for the given Locale
is a Dimension return it, otherwise return null. |
Font |
getFont(Object key)
Suppressed: If the value of key is a Font return it,
otherwise return null. |
Font |
getFont(Object key,
Locale l)
Suppressed: If the value of key for the given Locale
is a Font return it, otherwise return null. |
private Object |
getFromHashtable(Object key)
Looks up up the given key in our Hashtable and resolves LazyValues or ActiveValues. |
private Object |
getFromResourceBundle(Object key,
Locale l)
Looks up given key in our resource bundles. |
Icon |
getIcon(Object key)
Suppressed: If the value of key is an Icon return it,
otherwise return null. |
Icon |
getIcon(Object key,
Locale l)
Suppressed: If the value of key for the given Locale
is an Icon return it, otherwise return null. |
Insets |
getInsets(Object key)
Suppressed: If the value of key is an Insets return it,
otherwise return null. |
Insets |
getInsets(Object key,
Locale l)
Suppressed: If the value of key for the given Locale
is an Insets return it, otherwise return null. |
int |
getInt(Object key)
Suppressed: If the value of key is an Integer return its
integer value, otherwise return 0. |
int |
getInt(Object key,
Locale l)
Suppressed: If the value of key for the given Locale
is an Integer return its integer value, otherwise return 0. |
java.beans.PropertyChangeListener[] |
getPropertyChangeListeners()
Suppressed: Returns an array of all the PropertyChangeListeners added
to this UIDefaults with addPropertyChangeListener(). |
private Map |
getResourceCache(Locale l)
Returns a Map of the known resources for the given locale. |
String |
getString(Object key)
Suppressed: If the value of key is a String return it,
otherwise return null. |
String |
getString(Object key,
Locale l)
Suppressed: If the value of key for the given Locale
is a String return it, otherwise return null. |
javax.swing.plaf.ComponentUI |
getUI(JComponent target)
Suppressed: Creates an ComponentUI implementation for the
specified component. |
Class |
getUIClass(String uiClassID)
Suppressed: Returns the L&F class that renders this component. |
Class |
getUIClass(String uiClassID,
ClassLoader uiClassLoader)
Suppressed: The value of get(uidClassID) must be the
String 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)
Suppressed: Sets the value of key to value for all locales. |
void |
putDefaults(Object[] keyValueList)
Suppressed: Puts all of the key/value pairs in the database and unconditionally generates one PropertyChangeEvent. |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Suppressed: Removes a PropertyChangeListener from the listener list. |
void |
removeResourceBundle(String bundleName)
Suppressed: Removes a resource bundle from the list of resource bundles that are searched for localized defaults. |
void |
setDefaultLocale(Locale l)
Suppressed: Sets the default locale. |
| 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.util.Dictionary |
iterate |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
private static final Object PENDING
private SwingPropertyChangeSupport changeSupport
private Vector resourceBundles
private Locale defaultLocale
private Map resourceCache
| 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 Mapget in class Hashtablekey - the desired key
keyLazyValue,
ActiveValue,
java.util.Hashtable#get,
getDefaultLocale(),
addResourceBundle(java.lang.String)private Object getFromHashtable(Object key)
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.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 given locale.
LazyValues and ActiveValues are not supported
in the resource bundles.
key - the desired keyl - the desired locale
keyLazyValue,
ActiveValue,
java.util.Hashtable#get,
addResourceBundle(java.lang.String)
private Object getFromResourceBundle(Object key,
Locale l)
private Map getResourceCache(Locale l)
public Object put(Object key,
Object value)
key to value for all locales.
If key is a string and the new value isn't
equal to the old one, fire a PropertyChangeEvent.
If value is null, the key is removed from the table.
put in interface Mapput in class Hashtablekey - the unique Object who's value will be used
to retrieve the data value associated with itvalue - the new Object to store as data under
that key
Object value, or nullputDefaults(java.lang.Object[]),
java.util.Hashtable#putpublic void putDefaults(Object[] keyValueList)
PropertyChangeEvent.
The events oldValue and newValue will be null and its
propertyName will be "UIDefaults". The key/value pairs are
added for all locales.
keyValueList - an array of key/value pairsput(java.lang.Object, java.lang.Object),
java.util.Hashtable#putpublic Font getFont(Object key)
key is a Font return it,
otherwise return null.
key - the desired key
key is a Font,
return the Font object; otherwise return
null
public Font getFont(Object key,
Locale l)
key for the given Locale
is a Font return it, otherwise return null.
key - the desired keyl - the desired locale
key and Locale
is a Font,
return the Font object; otherwise return
nullpublic Color getColor(Object key)
key is a Color return it,
otherwise return null.
key - the desired key
key is a Color,
return the Color object; otherwise return
null
public Color getColor(Object key,
Locale l)
key for the given Locale
is a Color return it, otherwise return null.
key - the desired keyl - the desired locale
key and Locale
is a Color,
return the Color object; otherwise return
nullpublic Icon getIcon(Object key)
key is an Icon return it,
otherwise return null.
key - the desired key
key is an Icon,
return the Icon object; otherwise return
null
public Icon getIcon(Object key,
Locale l)
key for the given Locale
is an Icon return it, otherwise return null.
key - the desired keyl - the desired locale
key and Locale
is an Icon,
return the Icon object; otherwise return
nullpublic javax.swing.border.Border getBorder(Object key)
key is a Border return it,
otherwise return null.
key - the desired key
key is a Border,
return the Border object; otherwise return
null
public javax.swing.border.Border getBorder(Object key,
Locale l)
key for the given Locale
is a Border return it, otherwise return null.
key - the desired keyl - the desired locale
key and Locale
is a Border,
return the Border object; otherwise return
nullpublic String getString(Object key)
key is a String return it,
otherwise return null.
key - the desired key
key is a String,
return the String object; otherwise return
null
public String getString(Object key,
Locale l)
key for the given Locale
is a String return it, otherwise return null.
key - the desired keyl - the desired Locale
key for the given
Locale is a String,
return the String object; otherwise return
nullpublic int getInt(Object key)
key is an Integer return its
integer value, otherwise return 0.
key - the desired key
key is an Integer,
return its value, otherwise return 0
public int getInt(Object key,
Locale l)
key for the given Locale
is an Integer return its integer value, otherwise return 0.
key - the desired keyl - the desired locale
key and Locale
is an Integer,
return its value, otherwise return 0public boolean getBoolean(Object key)
key is boolean, return the
boolean value, otherwise return false.
key - an Object specifying the key for the desired boolean value
key is boolean, return the
boolean value, otherwise return false.
public boolean getBoolean(Object key,
Locale l)
key for the given Locale
is boolean, return the boolean value, otherwise return false.
key - an Object specifying the key for the desired boolean valuel - the desired locale
key and Locale
is boolean, return the
boolean value, otherwise return false.public Insets getInsets(Object key)
key is an Insets return it,
otherwise return null.
key - the desired key
key is an Insets,
return the Insets object; otherwise return
null
public Insets getInsets(Object key,
Locale l)
key for the given Locale
is an Insets return it, otherwise return null.
key - the desired keyl - the desired locale
key and Locale
is an Insets,
return the Insets object; otherwise return
nullpublic Dimension getDimension(Object key)
key is a Dimension return it,
otherwise return null.
key - the desired key
key is a Dimension,
return the Dimension object; otherwise return
null
public Dimension getDimension(Object key,
Locale l)
key for the given Locale
is a Dimension return it, otherwise return null.
key - the desired keyl - the desired locale
key and Locale
is a Dimension,
return the Dimension object; otherwise return
null
public Class getUIClass(String uiClassID,
ClassLoader uiClassLoader)
get(uidClassID) must be the
String name of a
class that implements the corresponding ComponentUI
class. If the class hasn't been loaded before, this method looks
up the class with uiClassLoader.loadClass() if a non
null
class loader is provided, classForName() otherwise.
If a mapping for uiClassID exists or if the specified
class can't be found, return null.
This method is used by getUI, it's usually
not necessary to call it directly.
uiClassID - a string containing the class IDuiClassLoader - the object which will load the class
Class.forName(get(uidClassID))getUI(javax.swing.JComponent)public Class getUIClass(String uiClassID)
uiClassID - a string containing the class ID
getUIClass(uiClassID, null)protected void getUIError(String msg)
getUI() fails for any reason,
it calls this method before returning null.
Subclasses may choose to do more or less here.
msg - message string to printgetUI(javax.swing.JComponent)public javax.swing.plaf.ComponentUI getUI(JComponent target)
ComponentUI implementation for the
specified component. In other words create the look
and feel specific delegate object for target.
This is done in two steps:
ComponentUI implementation
class under the value returned by target.getUIClassID().
createUI()
method to construct a look and feel delegate.
target - the JComponent which needs a UI
ComponentUI objectpublic void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
PropertyChangeListener to the listener list.
The listener is registered for all properties.
A PropertyChangeEvent will get fired whenever a default
is changed.
listener - the PropertyChangeListener to be addedjava.beans.PropertyChangeSupportpublic void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
PropertyChangeListener from the listener list.
This removes a PropertyChangeListener that was registered
for all properties.
listener - the PropertyChangeListener to be removedjava.beans.PropertyChangeSupportpublic java.beans.PropertyChangeListener[] getPropertyChangeListeners()
PropertyChangeListeners added
to this UIDefaults with addPropertyChangeListener().
PropertyChangeListeners added or an empty
array if no listeners have been added
protected void firePropertyChange(String propertyName,
Object oldValue,
Object newValue)
PropertyChangeEventx
listener list isn't empty, then fire a
PropertyChange event to each listener.
propertyName - the programmatic name of the property
that was changedoldValue - the old value of the propertynewValue - the new value of the propertyjava.beans.PropertyChangeSupportpublic void addResourceBundle(String bundleName)
bundleName - the base name of the resource bundle to be addedjava.util.ResourceBundle,
removeResourceBundle(java.lang.String)public void removeResourceBundle(String bundleName)
bundleName - the base name of the resource bundle to be removedjava.util.ResourceBundle,
addResourceBundle(java.lang.String)public void setDefaultLocale(Locale l)
get methods that do not take a
locale argument. As of release 1.4, Swing UI objects should retrieve
localized values using the locale of their component rather than the
default locale. The default locale exists to provide compatibility with
pre 1.4 behaviour.
getDefaultLocale(),
get(Object),
get(Object,Locale)public Locale getDefaultLocale()
get methods that do not take a
locale argument. As of release 1.4, Swing UI objects should retrieve
localized values using the locale of their component rather than the
default locale. The default locale exists to provide compatibility with
pre 1.4 behaviour.
setDefaultLocale(java.util.Locale),
get(Object),
get(Object,Locale)
|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||