Class ButtonGroup

  • All Implemented Interfaces:
    java.lang.Iterable<Button>, Group<Button>
    Direct Known Subclasses:
    RadioButtonGroup

    public class ButtonGroup
    extends java.lang.Object
    implements Group<Button>, java.lang.Iterable<Button>
    Class representing a toggle button group.
    • Constructor Detail

      • ButtonGroup

        public ButtonGroup()
    • Method Detail

      • add

        public boolean add​(Button button)
        Description copied from interface: Group
        Adds an element to the group.
        Specified by:
        add in interface Group<Button>
        Parameters:
        button - The element to add to the group.
        Returns:
        true if the element was added to the group; false, otherwise.
      • remove

        public boolean remove​(Button button)
        Description copied from interface: Group
        Removes an element from the group.
        Specified by:
        remove in interface Group<Button>
        Parameters:
        button - The element to remove from the set.
        Returns:
        true if the element was removed from the group; false, otherwise.
      • contains

        public boolean contains​(Button button)
        Description copied from interface: Group
        Tests the existence of an element in the group.
        Specified by:
        contains in interface Group<Button>
        Parameters:
        button - The element whose presence in the group is to be tested.
        Returns:
        true if the element exists in the group; false, otherwise.
      • getSelection

        public Button getSelection()
      • setSelection

        public void setSelection​(Button selection)
      • clearSelection

        public void clearSelection()
        Clear the currently selected item in this group, making all items unselected. This is a shortcut for setSelection(null).
      • iterator

        public java.util.Iterator<Button> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<Button>