I am trying to use CheckBoxTree and in that I would like to display checkbox only for those nodes who don't have any child node i.e. only for leaf nodes. But somehow I am not getting how to set this behaviour. The nodes in tree who have child node should display as a normal folder(with expand capability) icon without checkbox for the same.
Any idea on how to achieve this behaviour?
Any help would be appreciated.
Code snippet:
- Code: Select all
DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode(nodeName);
DefaultMutableTreeNode childeNode1 = new DefaultMutableTreeNode(nodeName1);
DefaultMutableTreeNode childeNode2 = new DefaultMutableTreeNode(nodeName2);
DefaultMutableTreeNode grandChildeNode3 = new DefaultMutableTreeNode(nodeName3);
rootNode.add(childeNode1);
rootNode.add(childeNode2);
childeNode2.add(grandChildeNode3);
CheckBoxTree tree = new CheckBoxTree(rootNode);
Thanks,
Mandar