Class JToggleButton.ToggleButtonModel

All Implemented Interfaces:
ItemSelectable, Serializable, ButtonModel
Enclosing class:
JToggleButton

public static class JToggleButton.ToggleButtonModel extends JToggleButton.ToggleButtonModel
The JDK's JToggleButton.ToggleButtonModel: a release while armed flips the selection, and a selection change fires ChangeEvent before ItemEvent.

Extends the JDK class and adds one thing: membership of a ButtonGroup. The JDK keeps the group on the model as a javax.swing.ButtonGroup, which this group is not, so the inherited getGroup() stays null and the group is consulted here instead, exactly where the JDK's setSelected consults its own.

See Also:
  • Constructor Details

    • ToggleButtonModel

      public ToggleButtonModel()
  • Method Details

    • setSelected

      public void setSelected(boolean b)
      Lets the group veto or redirect the change first: selecting deselects the group's previous selection, and deselecting the group's selection does nothing.
      Specified by:
      setSelected in interface ButtonModel
      Overrides:
      setSelected in class JToggleButton.ToggleButtonModel