Swing Checkbox Tree
A check box tree package based on John Zukowski's CheckBox Node Tree Sample code.
You can mix and match DefaultMutableTreeNode
and CheckBoxNodeData
node types. It also allows check box nodes as non-leaf nodes.
It uses a JCheckBox
+ JLabel
in a JPanel
to differentiate between clicking on a check box (to check/uncheck a node) versus a label (to select a node).
- License: BSD-2
- Dependencies: None
- Maven Central: org.scijava:swing-checkbox-tree
- Simple example: CheckBoxTreeSample
- Complex example: WatchEventsFrame
The latter example also has code for recursively toggling subtrees in response to boxes being checked or unchecked (see the treeNodesChanged
method).
See also this question on StackOverflow.