Hi, I have a peculiar problem.I have a root node A.To this root node,I am adding a child node B and to this node,I am adding another node C.My problem is when i am adding another child node to A,the labels to the nodes are sometimes missing.It's of this form.When i add another node to A,I am going for a full repaint of the tree.
A(root node) |_B | |_C | |_D | |_B |_C |_D Can anyone help me out? Thanx in advance.
So are you asking how to repaint the tree to make sure the newly added nodes show up properly? If so you should be able to run the validate() and repaint() and be in good shape. Am I missing something?
If this tree is a JTree, and your tree model is a DefaultTreeModel, then have a look at the API documentation for methods whose names start with "fire". You call the appropriate method from that list whenever you make a change to a node, or add a node, or delete a node. Calling validate() or repaint() is a crude solution that might not work well for large trees.
Joined: Sep 06, 2005
Thanx Paul, I am using validate().If it's not a good solution for large trees,then please suggest me another method.