Class QuadristateCheckbox

All Implemented Interfaces:
ImageObserver, ItemSelectable, MenuContainer, Serializable, Accessible, SwingConstants

public class QuadristateCheckbox extends JCheckBox
Checkbox with four states. Available states are UNCHECKED, CHECKED, GREY_CHECKED, GREY_UNCHECKED. The rendering is obtained via a visualization hack. The checkbox exploits the different rendering (greyed) of checkbox pressed, thus the press, arm, rollover events are not available. Maintenance tip - Some tricks are needed to get this code working: 1. You have to overwite addMouseListener() to do nothing 2. You have to add a mouse event on mousePressed by calling super.addMouseListener() 3. You have to replace the UIActionMap for the keyboard event "pressed" with your own one. 4. You have to remove the UIActionMap for the keyboard event "released". 5. You have to grab focus when the next state is entered, otherwise clicking on the component will not get the focus.
Author:
boldrini, bigagli
See Also: