Hi,
I need to change the icon of just a single, particular node in a JTree
when a JCheckbox is selected.
I understand I will need to extend DefaultTreeCellRenderer to just
change the icon of a single node in the tree. I've also extended
DefaultMutableTreeNode to give it more functionality. But, I'm not
sure how to connect a checkbox to a particular tree node, and then have
the Renderer update the tree, based on the change?
Any help appreciated,
Thanks,
Gil
brightoceanlight@hotmail.com - 12 Jul 2005 13:38 GMT
I think I figured it out.
I need to keep the Nodes in the JTree global so they can be accessed by
ItemStateChanged or another listener attached to the checkbox. Then a
field is changed in the node, which I have extended, and then
JTree.updateUI() is called to update the renderer.
This works okay so far.
Christian Kaufhold - 12 Jul 2005 20:07 GMT
> I need to keep the Nodes in the JTree global so they can be accessed by
> ItemStateChanged or another listener attached to the checkbox. Then a
> field is changed in the node, which I have extended, and then
> JTree.updateUI() is called to update the renderer.
^^^^^^^^^^^^^^^^
Yikes!
Christian
brightoceanlight@hotmail.com - 13 Jul 2005 08:07 GMT
Hi Christian,
Why Yikes???
Is there a better way?
Gil
Christian Kaufhold - 15 Jul 2005 11:09 GMT
> Is there a better way?
DefaultTreeModel.nodeChanged
Christian