Contents | Package | Class | Tree | Deprecated | Index | Help Java 1.2 Beta 3
PREV | NEXT SHOW LISTS | HIDE LISTS

Class java.awt.swing.UIDefaults

java.lang.Object
    |
    +----java.util.Dictionary
            |
            +----java.util.Hashtable
                    |
                    +----java.awt.swing.UIDefaults

public class UIDefaults
extends Hashtable
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 Swing1.0 applications. It will not be possible to load serialized Swing1.0 objects with future releases of Swing. The JDK1.2 release of Swing will be the compatibility baseline for the serialized form of Swing objects.

See Also:
UIManager

Inner Class Summary
 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.
 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.
 

Constructor Summary
 UIDefaults()
Create an empty defaults table.
 UIDefaults(Object[] keyValueList)
Create a defaults table initialized with the specified key/value pairs.
 

Method Summary
void  addPropertyChangeListener(PropertyChangeListener listener)
Add a PropertyChangeListener to the listener list.
void  firePropertyChange(String propertyName, Object oldValue, Object newValue)
Support for reporting bound property changes.
Object  get(Object key)
 
Border  getBorder(Object key)
If the value of key 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.
Font  getFont(Object key)
If the value of key 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.
String  getString(Object key)
If the value of key is a String return it, otherwise return null.
java.awt.swing.plaf.ComponentUI  getUI(JComponent target)
Create an ComponentUI implementation for the specified component.
Class  getUIClass(String uiClassID)
The value of get(uidClassID) must be the String name of a class that implements the corresponding ComponentUI class.
void  getUIError(String msg)
If getUI() fails for any reason, it calls this method before returning null.
Object  put(Object key, Object value)
Set the value of key to value.
void  putDefaults(Object[] keyValueList)
Put all of the key/value pairs in the database and unconditionally generate one PropertyChangeEvent.
void  removePropertyChangeListener(PropertyChangeListener listener)
Remove a PropertyChangeListener from the listener list.
 
Methods inherited from class java.util.Hashtable
 clear, clone, contains, containsKey, containsValue, elements, entries, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values
 
Methods inherited from class java.util.Dictionary
 elements, get, isEmpty, keys, put, remove, size
 
Methods inherited from class java.lang.Object
 clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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);
 
Method Detail

get

public Object get(Object key)
Overrides:
get in class Hashtable

put

public Object put(Object key,
                  Object value)
Set the value of key to value. 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.
Overrides:
put in class Hashtable
See Also:
putDefaults, put

putDefaults

public 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 an Icon return it, otherwise return null.

getBorder

public Border getBorder(Object key)
If the value of key is a Border 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 java.awt.swing.plaf.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:

addPropertyChangeListener

public 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 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

Contents | Package | Class | Tree | Deprecated | Index | Help Java 1.2 Beta 3
PREV | NEXT SHOW LISTS | HIDE LISTS

Submit a bug or feature
Submit comments/suggestions about new javadoc look.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.