49 |
*/ |
*/ |
50 |
public interface ButtonModel extends ItemSelectable |
public interface ButtonModel extends ItemSelectable |
51 |
{ |
{ |
|
boolean isArmed(); |
|
|
void setArmed(boolean b); |
|
52 |
|
|
53 |
|
/** |
54 |
boolean isEnabled(); |
* Returns <code>true</code> if the button is armed, <code>false</code> |
55 |
void setEnabled(boolean b); |
* otherwise. |
56 |
|
* |
57 |
void setPressed(boolean b); |
* A button is armed, when the user has pressed the mouse over it, but has |
58 |
boolean isPressed(); |
* not yet released the mouse. |
59 |
|
* |
60 |
|
* @return <code>true</code> if the button is armed, <code>false</code> |
61 |
void removeActionListener(ActionListener l); |
* otherwise |
62 |
void addActionListener(ActionListener l); |
* |
63 |
|
* @see #setArmed(boolean) |
64 |
void addItemListener(ItemListener l); |
*/ |
65 |
void removeItemListener(ItemListener l); |
boolean isArmed(); |
66 |
|
|
67 |
void addChangeListener(ChangeListener l); |
/** |
68 |
void removeChangeListener(ChangeListener l); |
* Sets the armed flag of the button. |
69 |
|
* |
70 |
void setRollover(boolean b); |
* A button is armed, when the user has pressed the mouse over it, but has |
71 |
boolean isRollover(); |
* not yet released the mouse. |
72 |
|
* |
73 |
int getMnemonic(); |
* @param b <code>true</code> if the button is armed, <code>false</code> |
74 |
void setMnemonic(int key); |
* otherwise |
75 |
|
* |
76 |
void setActionCommand(String s); |
* @see #isArmed() |
77 |
String getActionCommand(); |
*/ |
78 |
|
void setArmed(boolean b); |
79 |
void setGroup(ButtonGroup group); |
|
80 |
|
/** |
81 |
void setSelected(boolean b); |
* Returns <code>true</code> if the button is enabled, <code>false</code> |
82 |
boolean isSelected(); |
* otherwise. |
83 |
|
* |
84 |
|
* When a button is disabled, it is usually grayed out and the user cannot |
85 |
|
* change its state. |
86 |
|
* |
87 |
|
* @return <code>true</code> if the button is enabled, <code>false</code> |
88 |
|
* otherwise |
89 |
|
* |
90 |
|
* @see #setEnabled(boolean) |
91 |
|
*/ |
92 |
|
boolean isEnabled(); |
93 |
|
|
94 |
|
/** |
95 |
|
* Sets the enabled flag of the button. |
96 |
|
* |
97 |
|
* When a button is disabled, it is usually grayed out and the user cannot |
98 |
|
* change its state. |
99 |
|
* |
100 |
|
* @param b <code>true</code> if the button is enabled, <code>false</code> |
101 |
|
* otherwise |
102 |
|
* |
103 |
|
* @see #isEnabled() |
104 |
|
*/ |
105 |
|
void setEnabled(boolean b); |
106 |
|
|
107 |
|
/** |
108 |
|
* Sets the pressed flag of the button. |
109 |
|
* |
110 |
|
* The button usually gets pressed when the user clicks on a button, it will |
111 |
|
* be un-pressed when the user releases the mouse. |
112 |
|
* |
113 |
|
* @param b <code>true</code> if the button is pressed, <code>false</code> |
114 |
|
* otherwise |
115 |
|
* |
116 |
|
* @see #isPressed() |
117 |
|
*/ |
118 |
|
void setPressed(boolean b); |
119 |
|
|
120 |
|
/** |
121 |
|
* Returns <code>true</code> if the button is pressed, <code>false</code> |
122 |
|
* otherwise. |
123 |
|
* |
124 |
|
* The button usually gets pressed when the user clicks on a button, it will |
125 |
|
* be un-pressed when the user releases the mouse. |
126 |
|
* |
127 |
|
* @return <code>true</code> if the button is pressed, <code>false</code> |
128 |
|
* otherwise |
129 |
|
* |
130 |
|
* @see #setPressed(boolean) |
131 |
|
*/ |
132 |
|
boolean isPressed(); |
133 |
|
|
134 |
|
/** |
135 |
|
* Removes an {@link ActionListener} from the list of registered listeners. |
136 |
|
* |
137 |
|
* @param l the action listener to remove |
138 |
|
* |
139 |
|
* @see #addActionListener(ActionListener) |
140 |
|
*/ |
141 |
|
void removeActionListener(ActionListener l); |
142 |
|
|
143 |
|
/** |
144 |
|
* Adds an {@link ActionListener} to the list of registered listeners. |
145 |
|
* |
146 |
|
* An <code>ActionEvent</code> is usually fired when the user clicks on a |
147 |
|
* button. |
148 |
|
* |
149 |
|
* @param l the action listener to add |
150 |
|
* |
151 |
|
* @see #removeActionListener(ActionListener) |
152 |
|
*/ |
153 |
|
void addActionListener(ActionListener l); |
154 |
|
|
155 |
|
/** |
156 |
|
* Adds an {@link ItemListener} to the list of registered listeners. |
157 |
|
* |
158 |
|
* An <code>ItemEvent</code> is usually fired when a button's selected |
159 |
|
* state changes. This applies only to buttons that support the selected |
160 |
|
* flag. |
161 |
|
* |
162 |
|
* @param l the item listener to add |
163 |
|
* |
164 |
|
* @see #removeItemListener(ItemListener) |
165 |
|
*/ |
166 |
|
void addItemListener(ItemListener l); |
167 |
|
|
168 |
|
/** |
169 |
|
* Adds an {@link ItemListener} to the list of registered listeners. |
170 |
|
* |
171 |
|
* @param l the item listener to add |
172 |
|
* |
173 |
|
* @see #removeItemListener(ItemListener) |
174 |
|
*/ |
175 |
|
void removeItemListener(ItemListener l); |
176 |
|
|
177 |
|
/** |
178 |
|
* Adds an {@link ChangeListener} to the list of registered listeners. |
179 |
|
* |
180 |
|
* A <code>ChangeEvent</code> is fired when any one of the button's flags |
181 |
|
* changes. |
182 |
|
* |
183 |
|
* @param l the change listener to add |
184 |
|
* |
185 |
|
* @see #removeChangeListener(ChangeListener) |
186 |
|
*/ |
187 |
|
void addChangeListener(ChangeListener l); |
188 |
|
|
189 |
|
/** |
190 |
|
* Adds an {@link ChangeListener} to the list of registered listeners. |
191 |
|
* |
192 |
|
* @param l the change listener to add |
193 |
|
* |
194 |
|
* @see #removeChangeListener(ChangeListener) |
195 |
|
*/ |
196 |
|
void removeChangeListener(ChangeListener l); |
197 |
|
|
198 |
|
/** |
199 |
|
* Sets the rollover flag of the button. |
200 |
|
* |
201 |
|
* A button is rollover-ed, when the user has moved the mouse over it, but has |
202 |
|
* not yet pressed the mouse. |
203 |
|
* |
204 |
|
* @param b <code>true</code> if the button is rollover, <code>false</code> |
205 |
|
* otherwise |
206 |
|
* |
207 |
|
* @see #isRollover() |
208 |
|
*/ |
209 |
|
void setRollover(boolean b); |
210 |
|
|
211 |
|
/** |
212 |
|
* Returns <code>true</code> if the button is rollover-ed, <code>false</code> |
213 |
|
* otherwise. |
214 |
|
* |
215 |
|
* A button is rollover-ed, when the user has moved the mouse over it, but has |
216 |
|
* not yet pressed the mouse. |
217 |
|
* |
218 |
|
* @return <code>true</code> if the button is rollover, <code>false</code> |
219 |
|
* otherwise |
220 |
|
* |
221 |
|
* @see #setRollover(boolean) |
222 |
|
*/ |
223 |
|
boolean isRollover(); |
224 |
|
|
225 |
|
/** |
226 |
|
* Returns the keyboard mnemonic for the button. This specifies a shortcut |
227 |
|
* or accelerator key that can be used to activate the button. |
228 |
|
* |
229 |
|
* @return the keyboard mnemonic for the button |
230 |
|
* |
231 |
|
* @see #setMnemonic(int) |
232 |
|
*/ |
233 |
|
int getMnemonic(); |
234 |
|
|
235 |
|
/** |
236 |
|
* Sets the keyboard mnemonic for the button. This specifies a shortcut |
237 |
|
* or accelerator key that can be used to activate the button. |
238 |
|
* |
239 |
|
* @param key the keyboard mnemonic for the button |
240 |
|
* |
241 |
|
* @see #getMnemonic() |
242 |
|
*/ |
243 |
|
void setMnemonic(int key); |
244 |
|
|
245 |
|
/** |
246 |
|
* Sets the action command for the button. This will be used in |
247 |
|
* <code>ActionEvents</code> fired by the button. |
248 |
|
* |
249 |
|
* @param s the action command to set |
250 |
|
* |
251 |
|
* @see #getActionCommand() |
252 |
|
*/ |
253 |
|
void setActionCommand(String s); |
254 |
|
|
255 |
|
/** |
256 |
|
* Returns the action command of the button. |
257 |
|
* |
258 |
|
* @return the action command of the button |
259 |
|
* |
260 |
|
* @see #setActionCommand(String) |
261 |
|
*/ |
262 |
|
String getActionCommand(); |
263 |
|
|
264 |
|
/** |
265 |
|
* Sets the button group for the button. Some kinds of button (e.g. radio |
266 |
|
* buttons) allow only one button within a button group selected at any one |
267 |
|
* time. |
268 |
|
* |
269 |
|
* @param group the button group to set |
270 |
|
*/ |
271 |
|
void setGroup(ButtonGroup group); |
272 |
|
|
273 |
|
/** |
274 |
|
* Sets the selected flag of the button. |
275 |
|
* |
276 |
|
* Some kinds of buttons (e.g. toggle buttons, check boxes, radio buttons) |
277 |
|
* can be in one of two states: selected or unselected. The selected state |
278 |
|
* is usually toggled by clicking on the button. |
279 |
|
* |
280 |
|
* @param b <code>true</code> if the button is selected, <code>false</code> |
281 |
|
* otherwise |
282 |
|
* |
283 |
|
* @see #isSelected() |
284 |
|
*/ |
285 |
|
void setSelected(boolean b); |
286 |
|
|
287 |
|
/** |
288 |
|
* Returns <code>true</code> if the button is selected, <code>false</code> |
289 |
|
* otherwise. |
290 |
|
* |
291 |
|
* Some kinds of buttons (e.g. toggle buttons, check boxes, radio buttons) |
292 |
|
* can be in one of two states: selected or unselected. The selected state |
293 |
|
* is usually toggled by clicking on the button. |
294 |
|
* |
295 |
|
* @return <code>true</code> if the button is selected, <code>false</code> |
296 |
|
* otherwise |
297 |
|
* |
298 |
|
* @see #setSelected(boolean) |
299 |
|
*/ |
300 |
|
boolean isSelected(); |
301 |
} |
} |