Serializable
public class CommandToggleButtonGroup extends Object implements Serializable
ButtonGroup
, this class
operates on buttons and not on button models.Modifier and Type | Field | Description |
---|---|---|
protected boolean |
allowsClearingSelection |
If
false , the selection cannot be cleared. |
protected Vector<JCommandToggleButton> |
buttons |
Contains all group buttons.
|
protected Map<JCommandToggleButton,ChangeListener> |
modelChangeListeners |
Map of registered model change listeners.
|
static String |
SELECTED_PROPERTY |
Name of the property change event fired when the group selection is
changed.
|
protected JCommandToggleButton |
selection |
The currently selected button.
|
Constructor | Description |
---|---|
CommandToggleButtonGroup() |
Creates a new button group.
|
Modifier and Type | Method | Description |
---|---|---|
void |
add(JCommandToggleButton b) |
Adds the specified button to the group.
|
void |
addPropertyChangeListener(PropertyChangeListener listener) |
Adds the specified property change listener on this button group.
|
void |
clearSelection() |
Clears the selection of this button group.
|
protected void |
firePropertyChange(String propertyName,
Object oldValue,
Object newValue) |
Fires a property change event on all registered listeners.
|
JCommandToggleButton |
getSelected() |
Returns the selected button of this group.
|
boolean |
isAllowsClearingSelection() |
Returns the current value for clearing selection.
|
void |
remove(JCommandToggleButton b) |
Removes the specified button from the group.
|
void |
removePropertyChangeListener(PropertyChangeListener listener) |
Removes the specified property change listener from this button group.
|
void |
setAllowsClearingSelection(boolean allowsClearingSelection) |
Sets the new value for clearing selection.
|
void |
setSelected(JCommandToggleButton button,
boolean isSelected) |
Changes the selected status of the specified button.
|
protected Vector<JCommandToggleButton> buttons
protected Map<JCommandToggleButton,ChangeListener> modelChangeListeners
public static final String SELECTED_PROPERTY
protected JCommandToggleButton selection
null
.protected boolean allowsClearingSelection
false
, the selection cannot be cleared. By default the
button group allows clearing the selection in clearSelection()
or setSelected(JCommandToggleButton, boolean)
(passing the
currently selected button and false
).public CommandToggleButtonGroup()
public void setAllowsClearingSelection(boolean allowsClearingSelection)
true
is
passed, the selection can be cleared in clearSelection()
or
setSelected(JCommandToggleButton, boolean)
(passing the
currently selected button and false
).allowsClearingSelection
- The new value for clearing selection.public boolean isAllowsClearingSelection()
true
is
returned when selection can be cleared in clearSelection()
or
setSelected(JCommandToggleButton, boolean)
(passing the
currently selected button and false
).public void add(JCommandToggleButton b)
b
- The button to be added.public void remove(JCommandToggleButton b)
b
- The button to be removedpublic void setSelected(JCommandToggleButton button, boolean isSelected)
button
- Button.isSelected
- Selection indication.public JCommandToggleButton getSelected()
null
.public void clearSelection()
public void addPropertyChangeListener(PropertyChangeListener listener)
listener
- Listener to add.public void removePropertyChangeListener(PropertyChangeListener listener)
listener
- Listener to remove.