Class ButtonGroup

java.lang.Object
com.ardor3d.extension.ui.util.ButtonGroup

public class ButtonGroup extends Object
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 Details

    • ButtonGroup

      public ButtonGroup()
  • Method Details

    • add

      public void add(UIButton button)
      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

      public void remove(UIButton button)
      Removes the button from the group.
      Parameters:
      button - the button to remove. no-op if null.
    • getButtons

      public Iterator<UIButton> getButtons()
      Returns:
      an Iterator of buttons currently in this group
    • getSelection

      public UIButton getSelection()
      Returns:
      the currently selected button or null if none have been selected yet.
    • setSelected

      public void setSelected(UIButton button, boolean selected)
      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 changing
      selected - true if this button is to be selected and all others in the group should be de-selected.
    • isSelected

      public boolean isSelected(UIButton button)
      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.