public class ValueButtonGroup<T> extends ButtonGroup
buttons
Constructor and Description |
---|
ValueButtonGroup()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
add(AbstractButton button,
T value)
Adds a button and associates a value with it.
|
void |
addChangeListener(ChangeListener listener)
Adds a listener which will be notified whenever this group's selected
value changes.
|
T |
getValue()
Returns the currently selected value, that is the value associated
with the currently selected button.
|
void |
remove(AbstractButton button) |
void |
removeChangeListener(ChangeListener listener)
Removes a listener previously added by
addChangeListener . |
void |
setValue(T value)
Sets the currently selected value.
|
add, clearSelection, getButtonCount, getElements, getSelection, isSelected, setSelected
public void add(AbstractButton button, T value)
button
is selected, getValue()
will
return value
. You can use null
for a
value, but don't have two buttons with associated values which
are equal.button
- buttonvalue
- associated valuepublic void remove(AbstractButton button)
remove
in class ButtonGroup
public T getValue()
public void setValue(T value)
value
must be one
of the values associated with a button in this group.value
- new valuepublic void addChangeListener(ChangeListener listener)
listener
- listener to addpublic void removeChangeListener(ChangeListener listener)
addChangeListener
.listener
- listener to removeCopyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.