/[classpath]/classpath/javax/swing/plaf/metal/MetalSliderUI.java
ViewVC logotype

Diff of /classpath/javax/swing/plaf/metal/MetalSliderUI.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by rabbit78, Thu Apr 14 18:00:46 2005 UTC revision 1.2 by rabbit78, Mon Apr 18 23:08:06 2005 UTC
# Line 38  exception statement from your version. * Line 38  exception statement from your version. *
38    
39  package javax.swing.plaf.metal;  package javax.swing.plaf.metal;
40    
41    import java.util.HashMap;
42    
43  import javax.swing.JComponent;  import javax.swing.JComponent;
44  import javax.swing.plaf.ComponentUI;  import javax.swing.plaf.ComponentUI;
45  import javax.swing.plaf.basic.BasicSliderUI;  import javax.swing.plaf.basic.BasicSliderUI;
# Line 46  public class MetalSliderUI Line 48  public class MetalSliderUI
48    extends BasicSliderUI    extends BasicSliderUI
49  {  {
50    
51    // FIXME: maybe replace by a Map of instances when this becomes stateful    /** The UI instances for MetalSliderUIs */
52    /** The shared UI instance for MetalSliderUIs */    private static HashMap instances;
   private static MetalSliderUI instance = null;  
53    
54    /**    /**
55     * Constructs a new instance of MetalSliderUI.     * Constructs a new instance of MetalSliderUI.
# Line 67  public class MetalSliderUI Line 68  public class MetalSliderUI
68     */     */
69    public static ComponentUI createUI(JComponent component)    public static ComponentUI createUI(JComponent component)
70    {    {
71      if (instance == null)      if (instances == null)
72        instance = new MetalSliderUI();        instances = new HashMap();
73    
74    
75        Object o = instances.get(component);
76        MetalSliderUI instance;
77        if (o == null)
78          {
79            instance = new MetalSliderUI();
80            instances.put(component, instance);
81          }
82        else
83          instance = (MetalSliderUI) o;
84    
85      return instance;      return instance;
86    }    }
87  }  }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26