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. |
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 |
} |
} |