Use check boxes in a Swing JTree.
Java Shell
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.travis
src Happy New Year 2017 Feb 28, 2017
.gitignore
.travis.yml
LICENSE.txt Happy New Year 2017 Feb 28, 2017
README.md
pom.xml POM: update pom-scijava parent to 17.1.1 Nov 1, 2017

README.md

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).

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.