Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

display large XML tree  RSS feed

 
RichardLeeOne
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,
I have a large XML file, I tried to use JTree to display it, but it throws outofmemory exception.
Does any one here has experience on how to display it in a Jtree? The problem is how to defer display the tree node when it is going to be expanded, and truncate the node when the tree is collpased.
Appreciated if some one can show me some codes.
- richardlee2061@yahoo.com
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"RichardLeeOne" -

Welcome to the JavaRanch! Please adjust your displayed name to meet the
JavaRanch Naming Policy.
You can change it here.

As far as your question... the class you are looking for is TreeWillExpandListener. Though whether it will help or not depends on why you are getting an OutOfMemoryError... Making a "lazy-loading" tree won't help if the error is being thrown in the XML parsing...

Thanks! and welcome to the JavaRanch!
 
Sonny Pondrom
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am curious about what is being used for the tree node. Are you parsing the code to make each subcommand a node?
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!