|
-
September 22nd, 2000, 11:26 AM
#1
How do I refresh a JTree?
I'm having problems getting a JTree to reflect changes made to it's nodes. Basically, my tree contains a JPanel at each node. If I add or take away objects to those JPanels it is correctly done in software (an eneumeration of all the components in a given pane lists what it should contain). For some reason the added components do not appear in the JTree. I'm assuming this is just a problem with refreshing/updating the display. I've tried invalidate/validate and update, but nothing seems to work. Is there something I'm overlooking?
Thanks!
"There's nothing more dangerous than a resourceful idiot." ---Dilbert
BWAHAHAHAHAHAHA! ---Murray
-
September 29th, 2000, 04:54 AM
#2
Re: How do I refresh a JTree?
U can refresh a JTree by invoking
DefaultTreeModel.reload()
If everything is right with panels then the validate method should definitely work
Regards
Praveen
When going gets tough,
Tough gets going.
-
September 29th, 2000, 02:19 PM
#3
Re: How do I refresh a JTree?
Are you wanting to refresh the data? or the painting of your tree?
I refreshed mine by setting the model to null. Then, my 'new' model is lazy initialized the next time the JTree requests data. this effectively refreshes both the data and the painting.
I created a button, who's action sets the model to null...
HOpe that helps,
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|