Package com.ardor3d.extension.ui.util
Class ButtonGroup
java.lang.Object
com.ardor3d.extension.ui.util.ButtonGroup
Defines a group of buttons. This is generally used with radio or toggle buttons to indicate a group wherein only one
button should be pressed at a time.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a button to this button group if not already present.int
boolean
isSelected
(UIButton button) void
Removes the button from the group.void
setSelected
(UIButton button, boolean selected) Sets the selected value for the given button.
-
Constructor Details
-
ButtonGroup
public ButtonGroup()
-
-
Method Details
-
add
Add a button to this button group if not already present.- Parameters:
button
- the button to be added- Throws:
NullPointerException
- if button is null
-
remove
Removes the button from the group.- Parameters:
button
- the button to remove. no-op if null.
-
getButtons
- Returns:
- an Iterator of buttons currently in this group
-
getSelection
- Returns:
- the currently selected button or null if none have been selected yet.
-
setSelected
Sets the selected value for the given button. Only one button in the group may be selected at a time.- Parameters:
button
- the button we are changingselected
- true if this button is to be selected and all others in the group should be de-selected.
-
isSelected
- Parameters:
button
- the button- Returns:
- true if the button is the currently selected button
-
getButtonCount
public int getButtonCount()- Returns:
- the number of buttons currently in the group.
-