Basically I edit an attribute private string status="OK"
in the UserObject()
of a DefaultTreeNode()
.
I have a CustomRenderer which implements DefaultCellRenderer
, which sets the Icon by rendering the "OK" attribute of UserObject
of a TreeNode
.
Originally, when I select a node, the icon changes. I am using Tree.revalidate()
& Tree.repaint()
, and the change is being reflected.
However, I am not sure if this very efficient. What would be the proper way of doing this? I tried doing TreeModel.nodesChanged(new DefaultMutableTreeNode(myUserObject))
but the TreeNodeChanged event
will not fire.
So am I stuck to using repainting the entire tree everytime a userboject of a TreeNode is changed to see the graphic update?