java.io.Serializable
public class CommandToggleButtonGroup
extends java.lang.Object
implements java.io.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 java.util.Vector<JCommandToggleButton> |
buttons |
Contains all group buttons.
|
protected java.util.Map<JCommandToggleButton,javax.swing.event.ChangeListener> |
modelChangeListeners |
Map of registered model change listeners.
|
static java.lang.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(java.beans.PropertyChangeListener listener) |
Adds the specified property change listener on this button group.
|
void |
clearSelection() |
Clears the selection of this button group.
|
protected void |
firePropertyChange(java.lang.String propertyName,
java.lang.Object oldValue,
java.lang.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(java.beans.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 java.util.Vector<JCommandToggleButton> buttons
protected java.util.Map<JCommandToggleButton,javax.swing.event.ChangeListener> modelChangeListeners
public static final java.lang.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(java.beans.PropertyChangeListener listener)
listener
- Listener to add.public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
- Listener to remove.protected void firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
propertyName
- Name of the changed property.oldValue
- Old property value.newValue
- New property value.