summaryrefslogtreecommitdiff
path: root/javax
diff options
context:
space:
mode:
authorRoman Kennke <roman@kennke.org>2005-04-15 09:01:48 +0000
committerRoman Kennke <roman@kennke.org>2005-04-15 09:01:48 +0000
commit2a62828845865ad2807fbdefac823426532b8333 (patch)
tree0b10f0ef876390085eefbad901adc7552dcde0ee /javax
parent758eb34b34d82a19db641ca064b32419e78524a8 (diff)
downloadclasspath-2a62828845865ad2807fbdefac823426532b8333.tar.gz
2005-04-15 Roman Kennke <roman@kennke.org>
* javax/swing/plaf/metal/MetalTabbedPaneUI.java (createUI): Create one MetalTabbedPaneUI per Component instead of sharing one instance.
Diffstat (limited to 'javax')
-rw-r--r--javax/swing/plaf/metal/MetalTabbedPaneUI.java20
1 files changed, 16 insertions, 4 deletions
diff --git a/javax/swing/plaf/metal/MetalTabbedPaneUI.java b/javax/swing/plaf/metal/MetalTabbedPaneUI.java
index 4c1f7b096..3daecc09a 100644
--- a/javax/swing/plaf/metal/MetalTabbedPaneUI.java
+++ b/javax/swing/plaf/metal/MetalTabbedPaneUI.java
@@ -38,6 +38,8 @@ exception statement from your version. */
package javax.swing.plaf.metal;
+import java.util.HashMap;
+import java.util.Map;
import javax.swing.JComponent;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.basic.BasicTabbedPaneUI;
@@ -46,9 +48,8 @@ public class MetalTabbedPaneUI
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 Map instances = null;
/**
* Constructs a new instance of MetalTabbedPaneUI.
@@ -67,8 +68,19 @@ public class MetalTabbedPaneUI
*/
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;
}
}