wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes dynamically removing leaf from Jtree Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "dynamically removing leaf from Jtree" Watch "dynamically removing leaf from Jtree" New topic

dynamically removing leaf from Jtree

Chris Harris
Ranch Hand

Joined: Sep 21, 2003
Posts: 231
Hi all,

I am writting a Jtree that needs to do the following.
1)When a node is expaneded a leaf is displayed say "Loading Please Wait".
2)The system the loads the data
3)Once loaded the "Loading Please Wait" is removed
4)New children are then added to the expanded node.
However I have a small problem:
I using a TreeExpansionListener and have the following code.

However the new leaf "loaded" is not displayed.
I first but this down to the probelm that the tree was not being repainted. So I added tree.validate() and tree.repaint() but that did not help. So thinking it was a problem with my load code I removed that to. I am sure that the node I am removing and adding the leaf to is correct. Has anyone got any ideas?

[ November 13, 2003: Message edited by: Chris Harris ]

Chris Harris
Ranch Hand

Joined: Sep 21, 2003
Posts: 231
Ohh, I have only been removing it from the view not the model!!!
I agree. Here's the link: http://aspose.com/file-tools
subject: dynamically removing leaf from Jtree
Similar Threads
Expand Lazy Loaded JTree
collapsing JTree
Lazy fetching JTree
JTree reload question, AGAIN