58 @SuppressWarnings("serial") // Same-version serialization only |
58 @SuppressWarnings("serial") // Same-version serialization only |
59 public class MetalToggleButtonUI extends BasicToggleButtonUI { |
59 public class MetalToggleButtonUI extends BasicToggleButtonUI { |
60 |
60 |
61 private static final Object METAL_TOGGLE_BUTTON_UI_KEY = new Object(); |
61 private static final Object METAL_TOGGLE_BUTTON_UI_KEY = new Object(); |
62 |
62 |
|
63 /** |
|
64 * The color of a focused toggle button. |
|
65 */ |
63 protected Color focusColor; |
66 protected Color focusColor; |
|
67 |
|
68 /** |
|
69 * The color of a selected button. |
|
70 */ |
64 protected Color selectColor; |
71 protected Color selectColor; |
|
72 |
|
73 /** |
|
74 * The color of a disabled text. |
|
75 */ |
65 protected Color disabledTextColor; |
76 protected Color disabledTextColor; |
66 |
77 |
67 private boolean defaults_initialized = false; |
78 private boolean defaults_initialized = false; |
68 |
79 |
69 // ******************************** |
80 // ******************************** |
70 // Create PLAF |
81 // Create PLAF |
71 // ******************************** |
82 // ******************************** |
|
83 |
|
84 /** |
|
85 * Constructs the {@code MetalToogleButtonUI}. |
|
86 * |
|
87 * @param b a component |
|
88 * @return the {@code MetalToogleButtonUI}. |
|
89 */ |
72 public static ComponentUI createUI(JComponent b) { |
90 public static ComponentUI createUI(JComponent b) { |
73 AppContext appContext = AppContext.getAppContext(); |
91 AppContext appContext = AppContext.getAppContext(); |
74 MetalToggleButtonUI metalToggleButtonUI = |
92 MetalToggleButtonUI metalToggleButtonUI = |
75 (MetalToggleButtonUI) appContext.get(METAL_TOGGLE_BUTTON_UI_KEY); |
93 (MetalToggleButtonUI) appContext.get(METAL_TOGGLE_BUTTON_UI_KEY); |
76 if (metalToggleButtonUI == null) { |
94 if (metalToggleButtonUI == null) { |
99 } |
117 } |
100 |
118 |
101 // ******************************** |
119 // ******************************** |
102 // Default Accessors |
120 // Default Accessors |
103 // ******************************** |
121 // ******************************** |
|
122 /** |
|
123 * Returns the color of a selected button. |
|
124 * |
|
125 * @return the color of a selected button |
|
126 */ |
104 protected Color getSelectColor() { |
127 protected Color getSelectColor() { |
105 return selectColor; |
128 return selectColor; |
106 } |
129 } |
107 |
130 |
|
131 /** |
|
132 * Returns the color of a disabled text. |
|
133 * |
|
134 * @return the color of a disabled text |
|
135 */ |
108 protected Color getDisabledTextColor() { |
136 protected Color getDisabledTextColor() { |
109 return disabledTextColor; |
137 return disabledTextColor; |
110 } |
138 } |
111 |
139 |
|
140 /** |
|
141 * Returns the color of a focused toggle button. |
|
142 * |
|
143 * @return the color of a focused toggle button |
|
144 */ |
112 protected Color getFocusColor() { |
145 protected Color getFocusColor() { |
113 return focusColor; |
146 return focusColor; |
114 } |
147 } |
115 |
148 |
116 |
149 |