Skip to content.

Sections
Personal tools
You are here: Home » ダウンロード » uml_doclet » javax » swing » ButtonGroup

Document Actions

javax.swing
インタフェース ButtonModel

既知の実装クラスの一覧:
DefaultButtonModel

public abstract interface ButtonModel
extends java.awt.ItemSelectable

State Model for buttons. This model is used for checkboxes and radiobuttons, which are special kinds of buttons, as well as for normal buttons. For checkboxes and radiobuttons, 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() when a mouse click occurs over a checkbox or radiobutton. 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".


メソッドの概要
 void addActionListener(java.awt.event.ActionListener l)
          Adds an ActionListener to the button.
 void addChangeListener(javax.swing.event.ChangeListener l)
          Adds a ChangeListener to the button.
 void addItemListener(java.awt.event.ItemListener l)
          Adds an ItemListener to the button.
 java.lang.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(java.awt.event.ActionListener l)
          Removes an ActionListener from the button.
 void removeChangeListener(javax.swing.event.ChangeListener l)
          Removes a ChangeListener from the button.
 void removeItemListener(java.awt.event.ItemListener l)
          Removes an ItemListener from the button.
 void setActionCommand(java.lang.String s)
          Sets the actionCommand string that gets sent as part of the event when the button is pressed.
 void setArmed(boolean b)
          Marks the button as "armed".
 void setEnabled(boolean b)
          Enables or disables the button.
 void setGroup(ButtonGroup group)
          Identifies the group this button belongs to -- needed for radio buttons, which are mutually exclusive within their group.
 void setMnemonic(int key)
          Sets the keyboard mnemonic (shortcut key or accelerator key) for this button.
 void setPressed(boolean b)
          Sets the button to pressed or unpressed.
 void setRollover(boolean b)
          Sets or clears the button's rollover state
 void setSelected(boolean b)
          Selects or deselects the button.
 
インタフェース java.awt.ItemSelectable から継承したメソッド
getSelectedObjects
 

メソッドの詳細

isArmed

public boolean isArmed()
Indicates partial commitment towards pressing the button.
戻り値:
true if the button is armed, and ready to be pressed
関連項目:
setArmed(boolean)

isSelected

public boolean isSelected()
Indicates if the button has been selected. Only needed for certain types of buttons - such as RadioButton or Checkbox.
戻り値:
true if the button is selected

isEnabled

public boolean isEnabled()
Indicates if the button can be selected or pressed by an input device (such as a mouse pointer). (Checkbox-buttons are selected, regular buttons are "pressed".)
戻り値:
true if the button is enabled, and therefore selectable (or pressable)

isPressed

public boolean isPressed()
Indicates if button has been pressed.
戻り値:
true if the button has been pressed

isRollover

public boolean isRollover()
Indicates that the mouse is over the button.
戻り値:
true if the mouse is over the button

setArmed

public void setArmed(boolean b)
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.
パラメータ:
b - true to arm the button so it can be selected

setSelected

public void setSelected(boolean b)
Selects or deselects the button.
パラメータ:
b - true selects the button, false deselects the button.

setEnabled

public void setEnabled(boolean b)
Enables or disables the button.
パラメータ:
b - true to enable the button
関連項目:
isEnabled()

setPressed

public void setPressed(boolean b)
Sets the button to pressed or unpressed.
パラメータ:
b - true to set the button to "pressed"
関連項目:
isPressed()

setRollover

public void setRollover(boolean b)
Sets or clears the button's rollover state
パラメータ:
b - true to turn on rollover
関連項目:
isRollover()

setMnemonic

public void setMnemonic(int key)
Sets the keyboard mnemonic (shortcut key or accelerator key) for this button.
パラメータ:
key - an int specifying the accelerator key

getMnemonic

public int getMnemonic()
Gets the keyboard mnemonic for this model
戻り値:
an int specifying the accelerator key
関連項目:
setMnemonic(int)

setActionCommand

public void setActionCommand(java.lang.String s)
Sets the actionCommand string that gets sent as part of the event when the button is pressed.
パラメータ:
s - the String that identifies the generated event

getActionCommand

public java.lang.String getActionCommand()
Returns the action command for this button.
戻り値:
the String that identifies the generated event
関連項目:
setActionCommand(java.lang.String)

setGroup

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

addActionListener

public void addActionListener(java.awt.event.ActionListener l)
Adds an ActionListener to the button.
パラメータ:
l - the listener to add

removeActionListener

public void removeActionListener(java.awt.event.ActionListener l)
Removes an ActionListener from the button.
パラメータ:
l - the listener to remove

addItemListener

public void addItemListener(java.awt.event.ItemListener l)
Adds an ItemListener to the button.
定義:
インタフェース java.awt.ItemSelectable 内の addItemListener
パラメータ:
l - the listener to add

removeItemListener

public void removeItemListener(java.awt.event.ItemListener l)
Removes an ItemListener from the button.
定義:
インタフェース java.awt.ItemSelectable 内の removeItemListener
パラメータ:
l - the listener to remove

addChangeListener

public void addChangeListener(javax.swing.event.ChangeListener l)
Adds a ChangeListener to the button.
パラメータ:
l - the listener to add

removeChangeListener

public void removeChangeListener(javax.swing.event.ChangeListener l)
Removes a ChangeListener from the button.
パラメータ:
l - the listener to remove