Package com.tonic.vellum.widget
Class RadioGroup
- java.lang.Object
-
- com.tonic.vellum.Section
-
- com.tonic.vellum.widget.AbstractListSection
-
- com.tonic.vellum.widget.RadioGroup
-
public final class RadioGroup extends AbstractListSection
A single-choice option list; ENTER or SPACE chooses the option under the cursor, marked(o).
-
-
Constructor Summary
Constructors Constructor Description RadioGroup(java.lang.String... options)Creates a radio group with the given options.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RadioGroupchoose(int index)Chooses the option at the given index; firesonChangewhen it changes.intchosenIndex()RadioGrouponChange(java.util.function.IntConsumer handler)Sets the handler called with the chosen index whenever the choice changes.-
Methods inherited from class com.tonic.vellum.widget.AbstractListSection
onHighlight, onSelect, select, selectedIndex
-
-
-
-
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; firesonChangewhen 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
-
-