|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.swing.ButtonGroup
org.tbee.swing.JButtonGroup<T>
public class JButtonGroup<T>
Extends javax.swing.ButtonGroup to provide methods that allow working with button references instead of button models.
By using
bindValue(button, value)
or the associated
add(button, value)
it is possible to relate a value to a button.
By using setValue(), getValue() and the value property change event, the buttongroup can be bound to a bean property.
ButtonGroup,
Serialized Form| Field Summary | |
|---|---|
static String |
SOURCECODE_VERSION
Standard variable for determining version of a class file. |
static String |
VALUE_PROPERTY_ID
|
| Fields inherited from class javax.swing.ButtonGroup |
|---|
buttons |
| Constructor Summary | |
|---|---|
JButtonGroup()
Creates an empty JButtonGroup |
|
JButtonGroup(AbstractButton... buttons)
Creates a JButtonGroup object from an array of buttons and adds the buttons to the group
No button will be selected initially. |
|
| Method Summary | |
|---|---|
void |
add(AbstractButton... buttons)
Adds an array of buttons to the group |
void |
add(AbstractButton button)
Adds a button to the group |
void |
add(AbstractButton button,
T value)
Adds a button to the group |
void |
addPropertyChangeListener(PropertyChangeListener o)
|
void |
addPropertyChangeListener(String propertyName,
PropertyChangeListener o)
|
void |
bindValue(AbstractButton button,
T value)
store the relation between button and value |
boolean |
contains(AbstractButton button)
Checks whether the group contains the given button |
void |
firePropertyChange(String name,
T before,
T after)
|
void |
fireValueChangedIfRequired()
|
AbstractButton |
getButton(ButtonModel model)
Returns the AbstractButton whose ButtonModel is given. |
List<AbstractButton> |
getButtons()
Returns the buttons in the group as a List |
PropertyChangeListener[] |
getPropertyChangeListeners()
PropertyChange |
PropertyChangeListener[] |
getPropertyChangeListeners(String propertyName)
|
AbstractButton |
getSelected()
Returns the selected button in the group. |
T |
getValue()
|
boolean |
isEnabled()
|
boolean |
isSelected(AbstractButton button)
Returns whether the button is selected |
void |
remove(AbstractButton... buttons)
Removes all the buttons in the array from the group |
void |
remove(AbstractButton button)
Removes a button from the group |
void |
removePropertyChangeListener(PropertyChangeListener o)
|
void |
removePropertyChangeListener(String propertyName,
PropertyChangeListener o)
|
void |
setEnabled(boolean value)
Enabled |
void |
setSelected(AbstractButton button,
boolean selected)
Sets the selected button in the group Only one button in the group can be selected |
void |
setSelected(ButtonModel model,
boolean selected)
Sets the selected button model in the group |
void |
setValue(T value)
get the value of the selected button |
void |
unbindValue(AbstractButton button)
|
| Methods inherited from class javax.swing.ButtonGroup |
|---|
clearSelection, getButtonCount, getElements, getSelection, isSelected |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String SOURCECODE_VERSION
public static final String VALUE_PROPERTY_ID
| Constructor Detail |
|---|
public JButtonGroup()
JButtonGroup
public JButtonGroup(AbstractButton... buttons)
JButtonGroup object from an array of buttons and adds the buttons to the group
No button will be selected initially.
buttons - an array of AbstractButtons| Method Detail |
|---|
public void add(AbstractButton button)
add in class ButtonGroupbutton - an AbstractButton referencepublic void add(AbstractButton... buttons)
buttons - an array of AbstractButtonspublic void remove(AbstractButton button)
remove in class ButtonGroupbutton - the button to be removedpublic void remove(AbstractButton... buttons)
buttons - an array of AbstractButtons
public void setSelected(AbstractButton button,
boolean selected)
button - an AbstractButton referenceselected - an boolean representing the selection state of the button
public void setSelected(ButtonModel model,
boolean selected)
setSelected in class ButtonGroupmodel - a ButtonModel referenceselected - an boolean representing the selection state of the buttonpublic AbstractButton getButton(ButtonModel model)
AbstractButton whose ButtonModel is given.
If the model does not belong to a button in the group, returns null.
model - a ButtonModel that should belong to a button in the group
AbstractButton reference whose model is model if the button belongs to the group, nullotherwisepublic AbstractButton getSelected()
null if no button is selectedpublic boolean isSelected(AbstractButton button)
button - an AbstractButton reference
true if the button is selected, false otherwisepublic List<AbstractButton> getButtons()
List
List containing the buttons in the group, in the order they were added to the grouppublic boolean contains(AbstractButton button)
true if the button is contained in the group, false otherwisepublic void setEnabled(boolean value)
value - public boolean isEnabled()
public void setValue(T value)
public T getValue()
public void fireValueChangedIfRequired()
public void bindValue(AbstractButton button,
T value)
public void unbindValue(AbstractButton button)
public void add(AbstractButton button,
T value)
button - an AbstractButton referencepublic PropertyChangeListener[] getPropertyChangeListeners()
public void addPropertyChangeListener(PropertyChangeListener o)
public void removePropertyChangeListener(PropertyChangeListener o)
public PropertyChangeListener[] getPropertyChangeListeners(String propertyName)
public void addPropertyChangeListener(String propertyName,
PropertyChangeListener o)
public void removePropertyChangeListener(String propertyName,
PropertyChangeListener o)
public void firePropertyChange(String name,
T before,
T after)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||