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

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

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

revision 1.2 by mark, Sat Jul 2 20:32:51 2005 UTC revision 1.3 by langel, Wed Sep 14 20:25:13 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.BasicProgressBarUI;  import javax.swing.plaf.basic.BasicProgressBarUI;
46    
47  public class MetalProgressBarUI  public class MetalProgressBarUI
48    extends BasicProgressBarUI    extends BasicProgressBarUI
49  {  {  
50      /** The UI instances for MetalTreeUIs */
51    // FIXME: maybe replace by a Map of instances when this becomes stateful    private static HashMap instances = null;
   /** The shared UI instance for MetalProgressBarUIs */  
   private static MetalProgressBarUI instance = null;  
52    
53    /**    /**
54     * Constructs a new instance of MetalProgressBarUI.     * Constructs a new instance of MetalProgressBarUI.
# Line 67  public class MetalProgressBarUI Line 67  public class MetalProgressBarUI
67     */     */
68    public static ComponentUI createUI(JComponent component)    public static ComponentUI createUI(JComponent component)
69    {    {
70      if (instance == null)      if (instances == null)
71        instance = new MetalProgressBarUI();        instances = new HashMap();
72    
73        Object o = instances.get(component);
74        MetalProgressBarUI instance;
75        if (o == null)
76          {
77            instance = new MetalProgressBarUI();
78            instances.put(component, instance);
79          }
80        else
81          instance = (MetalProgressBarUI) o;
82    
83      return instance;      return instance;
84    }    }
85  }  }

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

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