S
Steve
I need to do some GUI implementation work in which a JTree is
implemented but each node in the tree needs to have a check box to
select/de-select that node as a User Interface requirement. I tried
simply creating a JCheckbox and adding it as a TreeNode but that simple
solution does not work:
DefaultMutableTreeNode category = null;
DefaultMutableTreeNode top =
new DefaultMutableTreeNode("Tree Test");
final JCheckBox check = new JCheckBox("Check Box test");
category = new DefaultMutableTreeNode(check);
top.add(category);
Can you suggest some code that would add a checkbox (and listener of
course) to each tree node that I add to the tree?
implemented but each node in the tree needs to have a check box to
select/de-select that node as a User Interface requirement. I tried
simply creating a JCheckbox and adding it as a TreeNode but that simple
solution does not work:
DefaultMutableTreeNode category = null;
DefaultMutableTreeNode top =
new DefaultMutableTreeNode("Tree Test");
final JCheckBox check = new JCheckBox("Check Box test");
category = new DefaultMutableTreeNode(check);
top.add(category);
Can you suggest some code that would add a checkbox (and listener of
course) to each tree node that I add to the tree?