[kaffe] CVS kaffe (robilad): Resynced with GNU Classpath: swing fix

Kaffe CVS cvs-commits at kaffe.org
Sat May 14 16:00:26 PDT 2005


PatchSet 6461 
Date: 2005/05/14 22:50:03
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath: swing fix

2005-05-15  Dalibor Topic  <robilad at kaffe.org>

        Resynced with GNU Classpath.

        2005-04-25  Roman Kennke  <roman at kennke.org>

        * javax/swing/plaf/metal/MetalTextFieldUI.java
        (createUI): Return one instance per Component instead of a
        shared instance.

Members: 
	ChangeLog:1.3988->1.3989 
	libraries/javalib/javax/swing/plaf/metal/MetalTextFieldUI.java:1.1->1.2 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3988 kaffe/ChangeLog:1.3989
--- kaffe/ChangeLog:1.3988	Sat May 14 22:47:36 2005
+++ kaffe/ChangeLog	Sat May 14 22:50:03 2005
@@ -2,6 +2,16 @@
 
 	Resynced with GNU Classpath.
 
+	2005-04-25  Roman Kennke  <roman at kennke.org>
+
+        * javax/swing/plaf/metal/MetalTextFieldUI.java
+        (createUI): Return one instance per Component instead of a
+        shared instance.
+
+2005-05-15  Dalibor Topic  <robilad at kaffe.org>
+
+	Resynced with GNU Classpath.
+
 	2005-03-22  Mike Stump  <mrs at apple.com>
 
         * native/fdlibm/ieeefp.h: ppc64 is also __IEEE_BIG_ENDIAN.
Index: kaffe/libraries/javalib/javax/swing/plaf/metal/MetalTextFieldUI.java
diff -u kaffe/libraries/javalib/javax/swing/plaf/metal/MetalTextFieldUI.java:1.1 kaffe/libraries/javalib/javax/swing/plaf/metal/MetalTextFieldUI.java:1.2
--- kaffe/libraries/javalib/javax/swing/plaf/metal/MetalTextFieldUI.java:1.1	Tue Apr 19 18:43:23 2005
+++ kaffe/libraries/javalib/javax/swing/plaf/metal/MetalTextFieldUI.java	Sat May 14 22:50:08 2005
@@ -38,6 +38,8 @@
 
 package javax.swing.plaf.metal;
 
+import java.util.HashMap;
+
 import javax.swing.JComponent;
 import javax.swing.plaf.ComponentUI;
 import javax.swing.plaf.basic.BasicTextFieldUI;
@@ -46,9 +48,8 @@
   extends BasicTextFieldUI
 {
 
-  // FIXME: maybe replace by a Map of instances when this becomes stateful
-  /** The shared UI instance for MetalTextFieldUIs */
-  private static MetalTextFieldUI instance = null;
+  /** The UI instances for MetalTextFieldUIs */
+  private static HashMap instances = null;
 
   /**
    * Constructs a new instance of MetalTextFieldUI.
@@ -67,8 +68,19 @@
    */
   public static ComponentUI createUI(JComponent component)
   {
-    if (instance == null)
-      instance = new MetalTextFieldUI();
+    if (instances == null)
+      instances = new HashMap();
+
+    Object o = instances.get(component);
+    MetalTextFieldUI instance;
+    if (o == null)
+      {
+	instance = new MetalTextFieldUI();
+	instances.put(component, instance);
+      }
+    else
+      instance = (MetalTextFieldUI) o;
+
     return instance;
   }
 }




More information about the kaffe mailing list