RadioButtonMenuItem
A menu item carrying a radio mark: a JRadioButtonMenuItem that shows selected and reports the user's activation through onSelectedChange. The item stands on its own, so activating it toggles the mark; for a set of items where at most one is marked, use RadioButtonMenuGroup.
A change the caller does not answer with a matching selected is settled back onto the declared value, so the mark on screen is the one the composition holds.
Parameters
the text of the menu item
whether the menu item is selected
callback invoked with the selected state when the item is activated
the SwingModifier applied to the underlying component
the key combination that activates the item without navigating the menu hierarchy, displayed next to its text; null (the default) leaves the item without one
See also
A JRadioButtonMenuItem driven by a raw ActionListener instead of an onSelectedChange lambda. The listener is attached as-is and removed on the same instance; pass a stable instance (e.g. remember {}) to avoid churn.
Parameters
the text of the menu item
whether the menu item is selected
the listener notified when the item is activated
the SwingModifier applied to the underlying component
the key combination that activates the item without navigating the menu hierarchy, displayed next to its text; null (the default) leaves the item without one