I have done some small changes to MetalTabbedPaneUI as suggested by
Michael.

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

        * javax/swing/plaf/metal/MetalTabbedPaneUI.java:
        Added newline between import blocks. Changed Map to
        HashMap in field declarations.

/Roman

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

Reply via email to