Module org.jpo

Class TristateCheckBox

All Implemented Interfaces:
ActionListener, ImageObserver, ItemSelectable, MenuContainer, Serializable, EventListener, Accessible, Icon, SwingConstants

public class TristateCheckBox extends JCheckBox implements Icon, ActionListener
The TristateCheckBox is a JCheckBox with a third state. It has an initial state of SELECTED, UNSELECTED or MIXED which it shows with a tick, no tick or a square in the icon. The click logic depends on whether there was a mixed initial state or not. If there was no mixed state then the user can only go from UNCHANGED to SELECT/UNSELECT and back to UNCHANGED. If there was a mixed state then the user can go from UNCHANGED to SELECT to UNSELECT and back to UNCHANGED.

Original code from StackOverflow customised by Richard Eigenmann

See Also: