38 |
|
|
39 |
package javax.swing.plaf.metal; |
package javax.swing.plaf.metal; |
40 |
|
|
|
import java.util.HashMap; |
|
|
|
|
41 |
import javax.swing.JComponent; |
import javax.swing.JComponent; |
42 |
|
import javax.swing.JTextField; |
43 |
import javax.swing.plaf.ComponentUI; |
import javax.swing.plaf.ComponentUI; |
44 |
import javax.swing.plaf.basic.BasicTextFieldUI; |
import javax.swing.plaf.basic.BasicTextFieldUI; |
45 |
|
|
46 |
public class MetalTextFieldUI |
/** |
47 |
extends BasicTextFieldUI |
* A UI delegate for the {@link JTextField} component. |
48 |
|
*/ |
49 |
|
public class MetalTextFieldUI extends BasicTextFieldUI |
50 |
{ |
{ |
|
|
|
|
/** The UI instances for MetalTextFieldUIs */ |
|
|
private static HashMap instances = null; |
|
|
|
|
51 |
/** |
/** |
52 |
* Constructs a new instance of MetalTextFieldUI. |
* Constructs a new instance of MetalTextFieldUI. |
53 |
*/ |
*/ |
57 |
} |
} |
58 |
|
|
59 |
/** |
/** |
60 |
* Returns an instance of MetalTextFieldUI. |
* Returns a new instance of <code>MetalTextFieldUI</code>. |
61 |
* |
* |
62 |
* @param component the component for which we return an UI instance |
* @param component the component for which we return an UI instance |
63 |
* |
* |
64 |
* @return an instance of MetalTextFieldUI |
* @return A new instance of <code>MetalTextFieldUI</code>. |
65 |
*/ |
*/ |
66 |
public static ComponentUI createUI(JComponent component) |
public static ComponentUI createUI(JComponent component) |
67 |
{ |
{ |
68 |
if (instances == null) |
return new MetalTextFieldUI(); |
|
instances = new HashMap(); |
|
|
|
|
|
Object o = instances.get(component); |
|
|
MetalTextFieldUI instance; |
|
|
if (o == null) |
|
|
{ |
|
|
instance = new MetalTextFieldUI(); |
|
|
instances.put(component, instance); |
|
|
} |
|
|
else |
|
|
instance = (MetalTextFieldUI) o; |
|
|
|
|
|
return instance; |
|
69 |
} |
} |
70 |
} |
} |