public class ButtonGroup extends ButtonGroup
ButtonGroup
object means
that turning "on" one of those buttons turns off all other buttons in the
group.
This class is an extension to javax.swing.ButtonGroup
, adding
support for MenuItem
objects.
MenuItem
,
ButtonGroup
,
Serialized FormModifier and Type | Field and Description |
---|---|
protected Vector<Object> |
buttons
The list of buttons participating in this group
|
Constructor and Description |
---|
ButtonGroup()
Creates a new
ButtonGroup . |
Modifier and Type | Method and Description |
---|---|
void |
add(AbstractButton b)
Adds the button to the group.
|
void |
add(MenuItem menuItem)
Adds the menu item to the group.
|
void |
clearSelection()
Clears the selection such that none of the buttons in the
ButtonGroup are selected. |
int |
getButtonCount()
Returns the number of buttons in the group.
|
Enumeration |
getElements()
Returns all the buttons that are participating in this group.
|
ButtonModel |
getSelection()
Returns the model of the selected button.
|
boolean |
isSelected(ButtonModel m)
Returns whether a
ButtonModel is selected. |
void |
remove(AbstractButton b)
Removes the button from the group.
|
void |
remove(MenuItem menuItem)
Removes the menu item from the group.
|
void |
setSelected(ButtonModel m,
boolean b)
Sets the selected value for the
ButtonModel . |
public void add(AbstractButton b)
add
in class ButtonGroup
b
- the button to be addedpublic void add(MenuItem menuItem)
menuItem
- the menu item to be addedpublic void remove(AbstractButton b)
remove
in class ButtonGroup
b
- the button to be removedpublic void remove(MenuItem menuItem)
menuItem
- the menu item to be removedpublic void clearSelection()
ButtonGroup
are selected.clearSelection
in class ButtonGroup
public Enumeration getElements()
getElements
in class ButtonGroup
Enumeration
of the buttons in this grouppublic ButtonModel getSelection()
getSelection
in class ButtonGroup
public void setSelected(ButtonModel m, boolean b)
ButtonModel
. Only one button
in the group may be selected at a time.setSelected
in class ButtonGroup
m
- the ButtonModel
b
- true
if this button is to be selected, otherwise
false
public boolean isSelected(ButtonModel m)
ButtonModel
is selected.isSelected
in class ButtonGroup
true
if the button is selected, otherwise returns
false
public int getButtonCount()
getButtonCount
in class ButtonGroup
Copyright © 2009 - 2016 DataGis. All Rights Reserved.