Index: javax/swing/UIDefaults.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/UIDefaults.java,v
retrieving revision 1.17
diff -u -r1.17 UIDefaults.java
--- javax/swing/UIDefaults.java 11 Jan 2005 22:46:39 -0000 1.17
+++ javax/swing/UIDefaults.java 6 Apr 2005 20:41:25 -0000
@@ -286,11 +286,8 @@
public Object put(Object key, Object value)
{
- Object old;
- if (value != null)
- old = super.put(key, value);
- else
- old = super.remove(key);
+ Object old = checkAndPut(key, value);
+
if (key instanceof String && old != value)
firePropertyChange((String) key, old, value);
return old;
@@ -300,11 +297,33 @@
{
for (int i = 0; (2 * i + 1) < entries.length; ++i)
{
- super.put(entries[2 * i], entries[2 * i + 1]);
+ checkAndPut(entries[2 * i], entries[2 * i + 1]);
}
firePropertyChange("UIDefaults", null, null);
}
+ /**
+ * Checks the value for null
and put it into the Hashtable, if
+ * it is not null
. If the value is null
then
+ * remove the corresponding key.
+ *
+ * @param key the key to put into this UIDefauls table
+ * @param value the value to put into this UIDefaults table
+ *
+ * @return the old value for key
+ */
+ private Object checkAndPut(Object key, Object value)
+ {
+ Object old;
+
+ if (value != null)
+ old = super.put(key, value);
+ else
+ old = super.remove(key);
+
+ return old;
+ }
+
public Font getFont(Object key)
{
Object o = get(key);