|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||

, JToggleButton.ToggleButtonModel

public interface ButtonModel

State Model for buttons. This model is used for check boxes and radio buttons, which are special kinds of buttons, as well as for normal buttons. For check boxes and radio buttons, pressing the mouse selects the button. For normal buttons, pressing the mouse "arms" the button. Releasing the mouse over the button then initiates a button press, firing its action event. Releasing the mouse elsewhere disarms the button.
In use, a UI will invoke setSelected(boolean)
when a mouse
click occurs over a check box or radio button. It will invoke
setArmed(boolean)
when the mouse is pressed over a regular
button and invoke setPressed(boolean)
when the mouse is released.
If the mouse travels outside the button in the meantime,
setArmed(false) will tell the button not to fire
when it sees setPressed. (If the mouse travels
back in, the button will be rearmed.)
Note:
A button is triggered when it is both "armed" and "pressed".
| Method Summary | |
|---|---|
void |
addActionListener
Adds an ActionListener to the button. |
void |
addChangeListener
Adds a ChangeListener to the button. |
void |
addItemListener
Adds an ItemListener to the button. |
String |
getActionCommand
Returns the action command for this button. |
int |
getMnemonic
Gets the keyboard mnemonic for this model |
boolean |
isArmed
Indicates partial commitment towards pressing the button. |
boolean |
isEnabled
Indicates if the button can be selected or pressed by an input device (such as a mouse pointer). |
boolean |
isPressed
Indicates if button has been pressed. |
boolean |
isRollover
Indicates that the mouse is over the button. |
boolean |
isSelected
Indicates if the button has been selected. |
void |
removeActionListener
Removes an ActionListener from the button. |
void |
removeChangeListener
Removes a ChangeListener from the button. |
void |
removeItemListener
Removes an ItemListener from the button. |
void |
setActionCommand
Sets the actionCommand string that gets sent as part of the event when the button is pressed. |
void |
setArmed
Marks the button as "armed". |
void |
setEnabled
Enables or disables the button. |
void |
setGroup
Identifies the group this button belongs to -- needed for radio buttons, which are mutually exclusive within their group. |
void |
setMnemonic
Sets the keyboard mnemonic (shortcut key or accelerator key) for this button. |
void |
setPressed
Sets the button to pressed or unpressed. |
void |
setRollover
Sets or clears the button's rollover state |
void |
setSelected
Selects or deselects the button. |
Methods inherited from interface java.awt.ItemSelectable ![]() |
|---|
getSelectedObjects |
| Method Detail |
|---|

boolean isArmed()
setArmed(boolean)


boolean isSelected()

boolean isEnabled()

boolean isPressed()

boolean isRollover()

void setArmed(boolean b)
b - true to arm the button so it can be selected

void setSelected(boolean b)
b - true selects the button,
false deselects the button.

void setEnabled(boolean b)
b - true to enable the buttonisEnabled()


void setPressed(boolean b)
b - true to set the button to "pressed"isPressed()


void setRollover(boolean b)
b - true to turn on rolloverisRollover()


void setMnemonic(int key)
key - an int specifying the accelerator key

int getMnemonic()
setMnemonic(int)


void setActionCommand(String![]()
![]()
s)
s - the String that identifies the generated event

String![]()
![]()
getActionCommand()
setActionCommand(java.lang.String)


void setGroup(ButtonGroup![]()
![]()
group)
group - the ButtonGroup this button belongs to

void addActionListener(ActionListener![]()
![]()
l)
l - the listener to add

void removeActionListener(ActionListener![]()
![]()
l)
l - the listener to remove

void addItemListener(ItemListener![]()
![]()
l)
addItemListener

in interface ItemSelectable

l - the listener to addItemEvent


void removeItemListener(ItemListener![]()
![]()
l)
removeItemListener

in interface ItemSelectable

l - the listener to removeItemEvent


void addChangeListener(ChangeListener![]()
![]()
l)
l - the listener to add

void removeChangeListener(ChangeListener![]()
![]()
l)
l - the listener to remove
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||