javax.swing
Interface ButtonModel

All Superinterfaces:
ItemSelectable
All Known Implementing Classes:
DefaultButtonModel

public interface ButtonModel
extends ItemSelectable

Unsafe:


Method Summary
 void addActionListener(ActionListener l)
          Enabled: Adds an ActionListener to the button.
 void addChangeListener(ChangeListener l)
          Enabled: Adds a ChangeListener to the button.
 void addItemListener(ItemListener l)
          Enabled: Adds an ItemListener to the button.
 String getActionCommand()
          Suppressed: Returns the action command for this button.
 int getMnemonic()
          Enabled: Gets the keyboard mnemonic for this model
 boolean isArmed()
          Enabled: Indicates partial commitment towards pressing the button.
 boolean isEnabled()
          Enabled: Indicates if the button can be selected or pressed by an input device (such as a mouse pointer).
 boolean isPressed()
          Enabled: Indicates if button has been pressed.
 boolean isRollover()
          Enabled: Indicates that the mouse is over the button.
 boolean isSelected()
          Enabled: Indicates if the button has been selected.
 void removeActionListener(ActionListener l)
          Enabled: Removes an ActionListener from the button.
 void removeChangeListener(ChangeListener l)
          Enabled: Removes a ChangeListener from the button.
 void removeItemListener(ItemListener l)
          Enabled: Removes an ItemListener from the button.
 void setActionCommand(String s)
          Enabled: Sets the actionCommand string that gets sent as part of the event when the button is pressed.
 void setArmed(boolean b)
          Enabled: Marks the button as "armed".
 void setEnabled(boolean b)
          Enabled: Enables or disables the button.
 void setGroup(ButtonGroup group)
          Enabled: Identifies the group this button belongs to -- needed for radio buttons, which are mutually exclusive within their group.
 void setMnemonic(int key)
          Enabled: Sets the keyboard mnemonic (shortcut key or accelerator key) for this button.
 void setPressed(boolean b)
          Enabled: Sets the button to pressed or unpressed.
 void setRollover(boolean b)
          Enabled: Sets or clears the button's rollover state
 void setSelected(boolean b)
          Enabled: Selects or deselects the button.
 
Methods inherited from interface java.awt.ItemSelectable
getSelectedObjects
 

Method Detail

isArmed

public boolean isArmed()
Enabled: Indicates partial commitment towards pressing the button.

Returns:
true if the button is armed, and ready to be pressed
See Also:
setArmed(boolean)

isSelected

public boolean isSelected()
Enabled: Indicates if the button has been selected. Only needed for certain types of buttons - such as radio buttons and check boxes.

Returns:
true if the button is selected

isEnabled

public boolean isEnabled()
Enabled: Indicates if the button can be selected or pressed by an input device (such as a mouse pointer). (Check boxes are selected, regular buttons are "pressed".)

Returns:
true if the button is enabled, and therefore selectable (or pressable)

isPressed

public boolean isPressed()
Enabled: Indicates if button has been pressed.

Returns:
true if the button has been pressed

isRollover

public boolean isRollover()
Enabled: Indicates that the mouse is over the button.

Returns:
true if the mouse is over the button

setArmed

public void setArmed(boolean b)
Enabled: Marks the button as "armed". If the mouse button is released while it is over this item, the button's action event fires. If the mouse button is released elsewhere, the event does not fire and the button is disarmed.

Parameters:
b - true to arm the button so it can be selected

setSelected

public void setSelected(boolean b)
Enabled: Selects or deselects the button.

Parameters:
b - true selects the button, false deselects the button.

setEnabled

public void setEnabled(boolean b)
Enabled: Enables or disables the button.

Parameters:
b - true to enable the button
See Also:
isEnabled()

setPressed

public void setPressed(boolean b)
Enabled: Sets the button to pressed or unpressed.

Parameters:
b - true to set the button to "pressed"
See Also:
isPressed()

setRollover

public void setRollover(boolean b)
Enabled: Sets or clears the button's rollover state

Parameters:
b - true to turn on rollover
See Also:
isRollover()

setMnemonic

public void setMnemonic(int key)
Enabled: Sets the keyboard mnemonic (shortcut key or accelerator key) for this button.

Parameters:
key - an int specifying the accelerator key

getMnemonic

public int getMnemonic()
Enabled: Gets the keyboard mnemonic for this model

Returns:
an int specifying the accelerator key
See Also:
setMnemonic(int)

setActionCommand

public void setActionCommand(String s)
Enabled: Sets the actionCommand string that gets sent as part of the event when the button is pressed.

Parameters:
s - the String that identifies the generated event

getActionCommand

public String getActionCommand()
Suppressed: Returns the action command for this button.

Returns:
the String that identifies the generated event
See Also:
setActionCommand(java.lang.String)

setGroup

public void setGroup(ButtonGroup group)
Enabled: Identifies the group this button belongs to -- needed for radio buttons, which are mutually exclusive within their group.

Parameters:
group - the ButtonGroup this button belongs to

addActionListener

public void addActionListener(ActionListener l)
Enabled: Adds an ActionListener to the button.

Parameters:
l - the listener to add

removeActionListener

public void removeActionListener(ActionListener l)
Enabled: Removes an ActionListener from the button.

Parameters:
l - the listener to remove

addItemListener

public void addItemListener(ItemListener l)
Enabled: Adds an ItemListener to the button.

Specified by:
addItemListener in interface ItemSelectable
Parameters:
l - the listener to add
See Also:
ItemEvent

removeItemListener

public void removeItemListener(ItemListener l)
Enabled: Removes an ItemListener from the button.

Specified by:
removeItemListener in interface ItemSelectable
Parameters:
l - the listener to remove
See Also:
ItemEvent

addChangeListener

public void addChangeListener(ChangeListener l)
Enabled: Adds a ChangeListener to the button.

Parameters:
l - the listener to add

removeChangeListener

public void removeChangeListener(ChangeListener l)
Enabled: Removes a ChangeListener from the button.

Parameters:
l - the listener to remove


comments?