javax.swing
Class ButtonGroup

java.lang.Object
  |
  +--javax.swing.ButtonGroup
All Implemented Interfaces:
Serializable

public class ButtonGroup
extends Object
implements Serializable

Safe:

See Also:
Serialized Form

Field Summary
protected  Vector buttons
           
(package private)  ButtonModel selection
          The current selection.
 
Constructor Summary
ButtonGroup()
          Enabled: Creates a new ButtonGroup.
 
Method Summary
 void add(AbstractButton b)
          Enabled: Adds the button to the group.
 int getButtonCount()
          Enabled: Returns the number of buttons in the group.
 Enumeration getElements()
          Enabled: Returns all the buttons that are participating in this group.
 ButtonModel getSelection()
          Enabled: Returns the model of the selected button.
 boolean isSelected(ButtonModel m)
          Enabled: Returns whether a ButtonModel is selected.
 void remove(AbstractButton b)
          Enabled: Removes the button from the group.
 void setSelected(ButtonModel m, boolean b)
          Enabled: Sets the selected value for the ButtonModel.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

buttons

protected Vector buttons

selection

ButtonModel selection
The current selection.

Constructor Detail

ButtonGroup

public ButtonGroup()
Enabled: Creates a new ButtonGroup.

Method Detail

add

public void add(AbstractButton b)
Enabled: Adds the button to the group.

Parameters:
b - the button to be added

remove

public void remove(AbstractButton b)
Enabled: Removes the button from the group.

Parameters:
b - the button to be removed

getElements

public Enumeration getElements()
Enabled: Returns all the buttons that are participating in this group.

Returns:
an Enumeration of the buttons in this group

getSelection

public ButtonModel getSelection()
Enabled: Returns the model of the selected button.

Returns:
the selected button model

setSelected

public void setSelected(ButtonModel m,
                        boolean b)
Enabled: Sets the selected value for the ButtonModel. Only one button in the group may be selected at a time.


isSelected

public boolean isSelected(ButtonModel m)
Enabled: Returns whether a ButtonModel is selected.

Returns:
true if the button is selected, otherwise returns false

getButtonCount

public int getButtonCount()
Enabled: Returns the number of buttons in the group.

Returns:
the button count
Since:
1.3


comments?