I am using JIDE’s CheckBoxTree to display a nested tree of checkboxes, as in this example:

I would like to know how many nodes the tree model contains.
If I call the method tree.getModel().getChildCount(rootNode), I only get the number of direct children (e.g. 12 in this case), and NOT the number of any children nested further (20+).
Recursively: