I could really use a tri-stated checkbox in Java. It sounds like a simple thing, but I've only seen really ugly implementations [note: link now broken].
Three radio buttons just take up too much real estate and will probably be confusing for the users in my case. It's basically for a search dialog. I need true, false or "don't care" options. Is there a different technique that people use?
A tri-state checkbox can be checked, not checked, or partially checked. The condition of being partially checked is based on the selection of child elements. If all child elements are selected, the parent checkbox is checked.
public class JCheckBox extends JToggleButton implements Accessible. An implementation of a check box -- an item that can be selected or deselected, and which displays its state to the user. By convention, any number of check boxes in a group can be selected.
JCheckBox often uses the methods isSelected and setSelected. To select, or un-select, a box, use the setSelected(boolean) method. To check if a box is selected, use the isSelected() method.
The method to set the state is JCheckBox. setSelected(boolean) and the method for getting the state is JCheckBox. isSelected() which return a boolean value.
Use a drop-down.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With