Class RadioGroup


  • public final class RadioGroup
    extends AbstractListSection
    A single-choice option list; ENTER or SPACE chooses the option under the cursor, marked (o).
    • Constructor Detail

      • RadioGroup

        public RadioGroup​(java.lang.String... options)
        Creates a radio group with the given options. The first option is chosen initially.
        Parameters:
        options - the option labels in order
    • Method Detail

      • chosenIndex

        public int chosenIndex()
        Returns:
        the index of the chosen option
      • choose

        public RadioGroup choose​(int index)
        Chooses the option at the given index; fires onChange when it changes. Out-of-range indices are ignored.
        Parameters:
        index - the option index to choose
        Returns:
        this RadioGroup for chaining
      • onChange

        public RadioGroup onChange​(java.util.function.IntConsumer handler)
        Sets the handler called with the chosen index whenever the choice changes.
        Parameters:
        handler - the change handler
        Returns:
        this RadioGroup for chaining