RadioGroup
A set of mutually exclusive choices, backed by a shared ButtonGroup, so at most one option is selected at a time.
Declare the choices in content; each option(...) becomes a JRadioButton laid out in the group's panel in call order. The selected option is controlled via selectedIndex (the zero-based position of the chosen option, or any out-of-range value such as -1 for no selection); clicking an option selects it and invokes onSelectionChange with its index, while external selectedIndex changes move the selection to match.
RadioGroup(selectedIndex = choice, onSelectionChange = { choice = it }) {
option("Small")
option("Medium")
option("Large")
}A pick the caller does not answer with a matching selectedIndex is settled back onto the declared one, so the option shown selected is the one the composition holds.
Parameters
the index of the selected option (controlled); an out-of-range value, such as -1, leaves every option unselected
callback invoked with the option's index when the user selects it
the SwingModifier applied to the group's panel
the SwingStyle applied to the group's panel; it wins over what a style provided for RadioGroups sets
the axis along which the options are arranged (a BoxAxis BoxLayout value); Y_AXIS - the default - stacks them in a column
declares the options; see RadioGroupScope