CheckBox
A JCheckBox, a labeled box the user turns on and off. The box shows whatever checked holds, and every toggle the user makes is reported through onCheckedChange. Boxes are independent of one another, so any number of them can be checked at once.
A toggle the caller does not answer with a matching checked does not stand: the box is back on the declared state before the toggle is painted.
Parameters
the text to display next to the checkbox
the checked state the box is held at
callback invoked with the checked state when the box is activated
the SwingModifier applied to the underlying component
See also
A CheckBox driven by a raw ActionListener instead of an onCheckedChange 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 checkbox
the checked state the box is held at
the listener notified when the checkbox is toggled
the SwingModifier applied to the underlying component