Package jexer

Class TRadioGroup

  • All Implemented Interfaces:
    java.lang.Comparable<TWidget>

    public class TRadioGroup
    extends TWidget
    TRadioGroup is a collection of TRadioButtons with a box and label.
    • Constructor Detail

      • TRadioGroup

        public TRadioGroup​(TWidget parent,
                           int x,
                           int y,
                           int width,
                           java.lang.String label)
        Public constructor.
        Parameters:
        parent - parent widget
        x - column relative to parent
        y - row relative to parent
        width - width of group
        label - label to display on the group box
      • TRadioGroup

        public TRadioGroup​(TWidget parent,
                           int x,
                           int y,
                           java.lang.String label)
        Public constructor.
        Parameters:
        parent - parent widget
        x - column relative to parent
        y - row relative to parent
        label - label to display on the group box
    • Method Detail

      • setWidth

        public void setWidth​(int width)
        Override TWidget's width: we can only set width at construction time.
        Overrides:
        setWidth in class TWidget
        Parameters:
        width - new widget width (ignored)
      • setHeight

        public void setHeight​(int height)
        Override TWidget's height: we can only set height at construction time.
        Overrides:
        setHeight in class TWidget
        Parameters:
        height - new widget height (ignored)
      • draw

        public void draw()
        Draw a radio button with label.
        Overrides:
        draw in class TWidget
      • getSelected

        public int getSelected()
        Get the radio button ID that was selected.
        Returns:
        ID of the selected button, or 0 if no button is selected
      • setSelected

        public void setSelected​(int id)
        Set the new selected radio button. 1-based.
        Parameters:
        id - ID of the selected button, or 0 to unselect
      • getSelectedButton

        public TRadioButton getSelectedButton()
        Get the radio button that was selected.
        Returns:
        the selected button, or null if no button is selected
      • addRadioButton

        public TRadioButton addRadioButton​(java.lang.String label,
                                           boolean selected)
        Convenience function to add a radio button to this group.
        Parameters:
        label - label to display next to (right of) the radiobutton
        selected - if true, this will be the selected radiobutton
        Returns:
        the new radio button
      • addRadioButton

        public TRadioButton addRadioButton​(java.lang.String label)
        Convenience function to add a radio button to this group.
        Parameters:
        label - label to display next to (right of) the radiobutton
        Returns:
        the new radio button
      • getRequiresSelection

        public boolean getRequiresSelection()
        Get the requires selection flag.
        Returns:
        true if this radiogroup requires that one of the buttons be selected
      • setRequiresSelection

        public void setRequiresSelection​(boolean requiresSelection)
        Set the requires selection flag.
        Parameters:
        requiresSelection - if true, then this radiogroup requires that one of the buttons be selected