50 * |
50 * |
51 * @author Tom Santos |
51 * @author Tom Santos |
52 */ |
52 */ |
53 @SuppressWarnings("serial") // Same-version serialization only |
53 @SuppressWarnings("serial") // Same-version serialization only |
54 public class MetalButtonUI extends BasicButtonUI { |
54 public class MetalButtonUI extends BasicButtonUI { |
|
55 |
55 // NOTE: These are not really needed, but at this point we can't pull |
56 // NOTE: These are not really needed, but at this point we can't pull |
56 // them. Their values are updated purely for historical reasons. |
57 // them. Their values are updated purely for historical reasons. |
|
58 /** |
|
59 * The color of the focused button. |
|
60 */ |
57 protected Color focusColor; |
61 protected Color focusColor; |
|
62 |
|
63 /** |
|
64 * The color of the selected button. |
|
65 */ |
58 protected Color selectColor; |
66 protected Color selectColor; |
|
67 |
|
68 /** |
|
69 * The color of the disabled color. |
|
70 */ |
59 protected Color disabledTextColor; |
71 protected Color disabledTextColor; |
60 |
72 |
61 private static final Object METAL_BUTTON_UI_KEY = new Object(); |
73 private static final Object METAL_BUTTON_UI_KEY = new Object(); |
62 |
74 |
63 // ******************************** |
75 // ******************************** |
64 // Create PLAF |
76 // Create PLAF |
65 // ******************************** |
77 // ******************************** |
|
78 |
|
79 /** |
|
80 * Returns an instance of {@code MetalButtonUI}. |
|
81 * |
|
82 * @param c a component |
|
83 * @return an instance of {@code MetalButtonUI} |
|
84 */ |
66 public static ComponentUI createUI(JComponent c) { |
85 public static ComponentUI createUI(JComponent c) { |
67 AppContext appContext = AppContext.getAppContext(); |
86 AppContext appContext = AppContext.getAppContext(); |
68 MetalButtonUI metalButtonUI = |
87 MetalButtonUI metalButtonUI = |
69 (MetalButtonUI) appContext.get(METAL_BUTTON_UI_KEY); |
88 (MetalButtonUI) appContext.get(METAL_BUTTON_UI_KEY); |
70 if (metalButtonUI == null) { |
89 if (metalButtonUI == null) { |
94 |
113 |
95 |
114 |
96 // ******************************** |
115 // ******************************** |
97 // Default Accessors |
116 // Default Accessors |
98 // ******************************** |
117 // ******************************** |
|
118 |
|
119 /** |
|
120 * Returns the color of the selected button. |
|
121 * |
|
122 * @return the color of the selected button |
|
123 */ |
99 protected Color getSelectColor() { |
124 protected Color getSelectColor() { |
100 selectColor = UIManager.getColor(getPropertyPrefix() + "select"); |
125 selectColor = UIManager.getColor(getPropertyPrefix() + "select"); |
101 return selectColor; |
126 return selectColor; |
102 } |
127 } |
103 |
128 |
|
129 /** |
|
130 * Returns the color of a disabled text. |
|
131 * |
|
132 * @return the color of a disabled text |
|
133 */ |
104 protected Color getDisabledTextColor() { |
134 protected Color getDisabledTextColor() { |
105 disabledTextColor = UIManager.getColor(getPropertyPrefix() + |
135 disabledTextColor = UIManager.getColor(getPropertyPrefix() + |
106 "disabledText"); |
136 "disabledText"); |
107 return disabledTextColor; |
137 return disabledTextColor; |
108 } |
138 } |
109 |
139 |
|
140 /** |
|
141 * Returns the color of the focused button. |
|
142 * |
|
143 * @return the color of the focused button |
|
144 */ |
110 protected Color getFocusColor() { |
145 protected Color getFocusColor() { |
111 focusColor = UIManager.getColor(getPropertyPrefix() + "focus"); |
146 focusColor = UIManager.getColor(getPropertyPrefix() + "focus"); |
112 return focusColor; |
147 return focusColor; |
113 } |
148 } |
114 |
149 |