RadioButton
A JRadioButton, a labeled button showing whether it is chosen. The button shows whatever selected holds, and every activation the user makes is reported through onSelectedChange. Standing alone it clears itself on a second click; making several buttons one choice takes a ButtonGroup. buttonGroup enrolls a button in one, and RadioGroup declares a whole choice.
An activation the caller does not answer with a matching selected does not stand: the button is back on the declared state before the click is painted.
Parameters
the text to display next to the radio button
whether the radio button is selected
callback invoked with the selected state when the button is activated
the SwingModifier applied to the underlying component
See also
A RadioButton driven by a raw ActionListener instead of an onSelectedChange lambda. The actionListener is attached as-is and removed on the same instance; pass a stable instance (e.g. remember {}) to avoid churn.
Parameters
the text to display next to the radio button
whether the radio button is selected
the listener notified when the radio button is activated
the SwingModifier applied to the underlying component