This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Refreshing JTree Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Refreshing JTree" Watch "Refreshing JTree" New topic
Author

Refreshing JTree

saurabh sood
Greenhorn

Joined: Nov 22, 2000
Posts: 17
hi,
i had written a swing application that converts xml to JTree. the problem i am having is that, though it displays JTree on start of the application, when i try loading another file througth the JMenu option of Open, it fails to display. i display the JTree using JScollPane. i guess i am refreshing it the wrong way. Really appreciate your help.
thanks
saurabh
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

You would want to create a new TreeModel from the new XML file and then call setModel() on the JTree with your new model. The tree should update automatically, since you are calling this from the menu item.


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Refreshing JTree