charvax.swing
public class ButtonGroup extends java.lang.Object implements ItemListener
Initially, all buttons in the group are unselected. Once any button in the group is selected, one button is always selected in the group.
Note that the ButtonGroup is a logical grouping, not a physical grouping. To create a button panel, you should still create a JPanel and add the JRadioButtons to it.
Constructor and Description |
---|
ButtonGroup()
Creates a new ButtonGroup
|
Modifier and Type | Method and Description |
---|---|
void |
add(AbstractButton button_)
Adds the specified button to the group.
|
int |
getButtonCount()
Returns the number of buttons in the ButtonGroup.
|
java.util.Enumeration |
getElements()
Returns an Enumeration of all the buttons in this group.
|
AbstractButton |
getSelection()
Get the selected radiobutton.
|
boolean |
isSelected(AbstractButton button_)
Returns the selected value for the specified button.
|
void |
itemStateChanged(ItemEvent e_)
Implements the ItemListener interface.
|
void |
remove(AbstractButton button_)
Remove the specified button from the group.
|
void |
setSelected(AbstractButton button_,
boolean val_)
Sets the selected value for the specified button.
|
public void add(AbstractButton button_)
public int getButtonCount()
public java.util.Enumeration getElements()
public AbstractButton getSelection()
public boolean isSelected(AbstractButton button_)
public void remove(AbstractButton button_)
public void setSelected(AbstractButton button_, boolean val_)
public void itemStateChanged(ItemEvent e_)
itemStateChanged
in interface ItemListener