JTree

How can i refresh a JTree. I am adding nodes to a leaf dynamically, The leaf should now appear as a folder but does not until i click it, when it then refreshes. Can i refresh the jtree or collapse and expand the parent node agen to reshow this node. Or is there a way i can get the listener to check for when the tree is changed and change accordingly. Also i use the JTree model not the DynamicTree

Thanks

[420 byte] By [Delaicerwa] at [2007-11-26 23:35:39]
# 1
Can you use repaint() after adding the nodes ?
Jatin_Kulkarnia at 2007-7-11 14:57:28 > top of Java-index,Desktop,Core GUI APIs...
# 2

How are you adding the nodes? Are you inserting them into the TreeModel, or just adding them to the parent node directly? If the latter you need to notify the tree that the model has changed. (If you add the nodes to the model itself, the model will notify the tree for you.)

I believe the JTree tutorial has examples of how to add nodes to a JTree

http://java.sun.com/docs/books/tutorial/uiswing/components/tree.html

Torgila at 2007-7-11 14:57:28 > top of Java-index,Desktop,Core GUI APIs...