This is possible with some work.
I have this code a few years ago. Based on some examples that I found on the Internet, but I can not find the link to the original creator, so I apologize
import javax.swing.*; import javax.swing.event.ChangeListener; import javax.swing.plaf.ActionMapUIResource; import java.awt.event.*; public class TristateCheckBox extends JCheckBox { public static class State { private State() { } } public static final State NOT_SELECTED = new State(); public static final State SELECTED = new State(); public static final State DONT_CARE = new State(); private final TristateDecorator model; public TristateCheckBox(String text, Icon icon, State initial){ super(text, icon);
source share