All Packages Class Hierarchy This Package Previous Next Index
Class com.sun.java.swing.UIDefaults
java.lang.Object
|
+----java.util.Dictionary
|
+----java.util.Hashtable
|
+----com.sun.java.swing.UIDefaults
- public class UIDefaults
- extends Hashtable
A table of defaults for Swing components.
-
UIDefaults()
- Create an empty defaults table.
-
UIDefaults(Object[])
- Create a defaults table initialized with the specified
key/value pairs.
-
addPropertyChangeListener(PropertyChangeListener)
- Add a PropertyChangeListener to the listener list.
-
firePropertyChange(String, Object, Object)
- Support for reporting bound property changes.
-
getColor(Object)
- If the value of
key
is a Color return it, otherwise
return null.
-
getFont(Object)
- If the value of
key
is a Font return it, otherwise
return null.
-
getIcon(Object)
- If the value of
key
is a Color return it, otherwise
return null.
-
getString(Object)
- If the value of
key
is a String return it, otherwise
return null.
-
getUI(JComponent)
- Create an ComponentUI implementation for the
specified component.
-
getUIClass(String)
- The value of get(uidClassID) must be the String name of a
class that implements the corresponding ComponentUI
class.
-
getUIError(String)
-
If getUI() fails for any reason, it calls this method before
returning null.
-
put(Object, Object)
- Set the non-null value of
key
to value
.
-
putDefaults(Object[])
- Put all of the key/value pairs in the database and
unconditionally generate one PropertyChangeEvent.
-
removePropertyChangeListener(PropertyChangeListener)
- Remove a PropertyChangeListener from the listener list.
UIDefaults
public UIDefaults()
- Create an empty defaults table.
UIDefaults
public UIDefaults(Object keyValueList[])
- Create a defaults table initialized with the specified
key/value pairs. For example:
Object[] uiDefaults = {
"Font", new Font("Dialog", Font.BOLD, 12),
"Color", Color.red,
"five", new Integer(5)
}
UIDefaults myDefaults = new UIDefaults(uiDefaults);
put
public synchronized Object put(Object key,
Object value)
- Set the non-null value of
key
to value
.
If key
is a string and the new value isn't
equal to the old one, fire a PropertyChangeEvent.
- Overrides:
- put in class Hashtable
- See Also:
- putDefaults, put
putDefaults
public synchronized void putDefaults(Object keyValueList[])
- Put all of the key/value pairs in the database and
unconditionally generate one PropertyChangeEvent.
The events oldValue and newValue will be null and its
propertyName will be "UIDefaults".
- See Also:
- put, put
getFont
public Font getFont(Object key)
- If the value of
key
is a Font return it, otherwise
return null.
getColor
public Color getColor(Object key)
- If the value of
key
is a Color return it, otherwise
return null.
getIcon
public Icon getIcon(Object key)
- If the value of
key
is a Color return it, otherwise
return null.
getString
public String getString(Object key)
- If the value of
key
is a String return it, otherwise
return null.
getUIClass
public Class getUIClass(String uiClassID)
- The value of get(uidClassID) must be the String name of a
class that implements the corresponding ComponentUI
class. This method looks up the class with
classForName()
and returns it. If no
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 neccessary to call it directly.
- Returns:
- The value of
Class.forName(get(uidClassID))
.
- See Also:
- getUI
getUIError
protected void getUIError(String msg)
- If getUI() fails for any reason, it calls this method before
returning null. Subclasses may choose to do more or
less here.
- Parameters:
- msg - Message string to print.
- See Also:
- getUI
getUI
public ComponentUI getUI(JComponent target)
- Create an 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:
- Lookup the name of the ComponentUI implementation
class under the value returned by target.getUIClassID().
- Use the implementation classes static
createUI()
method to construct a look and feel delegate.
addPropertyChangeListener
public synchronized void addPropertyChangeListener(PropertyChangeListener listener)
- Add a PropertyChangeListener to the listener list.
The listener is registered for all properties.
A PropertyChangeEvent will get fired whenever a default
is changed.
- Parameters:
- listener - The PropertyChangeListener to be added
- See Also:
- PropertyChangeSupport
removePropertyChangeListener
public synchronized void removePropertyChangeListener(PropertyChangeListener listener)
- Remove a PropertyChangeListener from the listener list.
This removes a PropertyChangeListener that was registered
for all properties.
- Parameters:
- listener - The PropertyChangeListener to be removed
- See Also:
- PropertyChangeSupport
firePropertyChange
protected void firePropertyChange(String propertyName,
Object oldValue,
Object newValue)
- Support for reporting bound property changes. If oldValue and
newValue are not equal and the PropertyChangeEvent listener list
isn't empty, then fire a PropertyChange event to each listener.
- Parameters:
- propertyName - The programmatic name of the property that was changed.
- oldValue - The old value of the property.
- newValue - The new value of the property.
- See Also:
- PropertyChangeSupport
All Packages Class Hierarchy This Package Previous Next Index