I commit the attached patch:

2005-04-18  Roman Kennke  <[EMAIL PROTECTED]>

       * javax/swing/plaf/metal/MetalScrollBarUI.java:
       (createUI): Instances cannot be shared among JScrollPanes.

/Roman

Index: javax/swing/plaf/metal/MetalScrollBarUI.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/javax/swing/plaf/metal/MetalScrollBarUI.java,v
retrieving revision 1.1
diff -u -r1.1 MetalScrollBarUI.java
--- javax/swing/plaf/metal/MetalScrollBarUI.java        14 Apr 2005 18:00:46 
-0000      1.1
+++ javax/swing/plaf/metal/MetalScrollBarUI.java        18 Apr 2005 10:23:14 
-0000
@@ -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.BasicScrollBarUI;
@@ -48,7 +50,7 @@
 
   // FIXME: maybe replace by a Map of instances when this becomes stateful
   /** The shared UI instance for JScrollBars. */
-  private static MetalScrollBarUI instance = null;
+  private static HashMap instances = null;
 
   /**
    * Constructs a new instance of MetalScrollBarUI.
@@ -67,8 +69,19 @@
    */
   public static ComponentUI createUI(JComponent component)
   {
-    if (instance == null)
-      instance = new MetalScrollBarUI();
+    if (instances == null)
+      instances = new HashMap();
+
+    Object o = instances.get(component);
+    MetalScrollBarUI instance;
+    if (o == null)
+      {
+       instance = new MetalScrollBarUI();
+       instances.put(component, instance);
+      }
+    else
+      instance = (MetalScrollBarUI) o;
+
     return instance;
   }
 }
_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to