Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / libjava / classpath / javax / swing / ButtonModel.java
blob03fac13d2fa5aafca9d588fe3420d3bf9da2b79c
1 /* ButtonModel.java --
2 Copyright (C) 2002, 2004 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING. If not, write to the
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 02110-1301 USA.
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library. Thus, the terms and
23 conditions of the GNU General Public License cover the whole
24 combination.
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module. An independent module is a module which is not derived from
33 or based on this library. If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so. If you do not wish to do so, delete this
36 exception statement from your version. */
39 package javax.swing;
41 import java.awt.ItemSelectable;
42 import java.awt.event.ActionListener;
43 import java.awt.event.ItemListener;
45 import javax.swing.event.ChangeListener;
47 /**
48 * The data model that is used in all kinds of buttons.
50 public interface ButtonModel extends ItemSelectable
53 /**
54 * Returns <code>true</code> if the button is armed, <code>false</code>
55 * otherwise.
57 * A button is armed, when the user has pressed the mouse over it, but has
58 * not yet released the mouse.
60 * @return <code>true</code> if the button is armed, <code>false</code>
61 * otherwise
63 * @see #setArmed(boolean)
65 boolean isArmed();
67 /**
68 * Sets the armed flag of the button.
70 * A button is armed, when the user has pressed the mouse over it, but has
71 * not yet released the mouse.
73 * @param b <code>true</code> if the button is armed, <code>false</code>
74 * otherwise
76 * @see #isArmed()
78 void setArmed(boolean b);
80 /**
81 * Returns <code>true</code> if the button is enabled, <code>false</code>
82 * otherwise.
84 * When a button is disabled, it is usually grayed out and the user cannot
85 * change its state.
87 * @return <code>true</code> if the button is enabled, <code>false</code>
88 * otherwise
90 * @see #setEnabled(boolean)
92 boolean isEnabled();
94 /**
95 * Sets the enabled flag of the button.
97 * When a button is disabled, it is usually grayed out and the user cannot
98 * change its state.
100 * @param b <code>true</code> if the button is enabled, <code>false</code>
101 * otherwise
103 * @see #isEnabled()
105 void setEnabled(boolean b);
108 * Sets the pressed flag of the button.
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.
113 * @param b <code>true</code> if the button is pressed, <code>false</code>
114 * otherwise
116 * @see #isPressed()
118 void setPressed(boolean b);
121 * Returns <code>true</code> if the button is pressed, <code>false</code>
122 * otherwise.
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.
127 * @return <code>true</code> if the button is pressed, <code>false</code>
128 * otherwise
130 * @see #setPressed(boolean)
132 boolean isPressed();
135 * Removes an {@link ActionListener} from the list of registered listeners.
137 * @param l the action listener to remove
139 * @see #addActionListener(ActionListener)
141 void removeActionListener(ActionListener l);
144 * Adds an {@link ActionListener} to the list of registered listeners.
146 * An <code>ActionEvent</code> is usually fired when the user clicks on a
147 * button.
149 * @param l the action listener to add
151 * @see #removeActionListener(ActionListener)
153 void addActionListener(ActionListener l);
156 * Adds an {@link ItemListener} to the list of registered listeners.
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.
162 * @param l the item listener to add
164 * @see #removeItemListener(ItemListener)
166 void addItemListener(ItemListener l);
169 * Adds an {@link ItemListener} to the list of registered listeners.
171 * @param l the item listener to add
173 * @see #removeItemListener(ItemListener)
175 void removeItemListener(ItemListener l);
178 * Adds an {@link ChangeListener} to the list of registered listeners.
180 * A <code>ChangeEvent</code> is fired when any one of the button's flags
181 * changes.
183 * @param l the change listener to add
185 * @see #removeChangeListener(ChangeListener)
187 void addChangeListener(ChangeListener l);
190 * Adds an {@link ChangeListener} to the list of registered listeners.
192 * @param l the change listener to add
194 * @see #removeChangeListener(ChangeListener)
196 void removeChangeListener(ChangeListener l);
199 * Sets the rollover flag of the button.
201 * A button is rollover-ed, when the user has moved the mouse over it, but has
202 * not yet pressed the mouse.
204 * @param b <code>true</code> if the button is rollover, <code>false</code>
205 * otherwise
207 * @see #isRollover()
209 void setRollover(boolean b);
212 * Returns <code>true</code> if the button is rollover-ed, <code>false</code>
213 * otherwise.
215 * A button is rollover-ed, when the user has moved the mouse over it, but has
216 * not yet pressed the mouse.
218 * @return <code>true</code> if the button is rollover, <code>false</code>
219 * otherwise
221 * @see #setRollover(boolean)
223 boolean isRollover();
226 * Returns the keyboard mnemonic for the button. This specifies a shortcut
227 * or accelerator key that can be used to activate the button.
229 * @return the keyboard mnemonic for the button
231 * @see #setMnemonic(int)
233 int getMnemonic();
236 * Sets the keyboard mnemonic for the button. This specifies a shortcut
237 * or accelerator key that can be used to activate the button.
239 * @param key the keyboard mnemonic for the button
241 * @see #getMnemonic()
243 void setMnemonic(int key);
246 * Sets the action command for the button. This will be used in
247 * <code>ActionEvents</code> fired by the button.
249 * @param s the action command to set
251 * @see #getActionCommand()
253 void setActionCommand(String s);
256 * Returns the action command of the button.
258 * @return the action command of the button
260 * @see #setActionCommand(String)
262 String getActionCommand();
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.
269 * @param group the button group to set
271 void setGroup(ButtonGroup group);
274 * Sets the selected flag of the button.
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.
280 * @param b <code>true</code> if the button is selected, <code>false</code>
281 * otherwise
283 * @see #isSelected()
285 void setSelected(boolean b);
288 * Returns <code>true</code> if the button is selected, <code>false</code>
289 * otherwise.
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.
295 * @return <code>true</code> if the button is selected, <code>false</code>
296 * otherwise
298 * @see #setSelected(boolean)
300 boolean isSelected();