Meaningless Drivel is fun!*
The moose likes Java in General and the fly likes Data Structure for displays in JTree? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Data Structure for displays in JTree?" Watch "Data Structure for displays in JTree?" New topic
Author

Data Structure for displays in JTree?

Nina Wang
Greenhorn

Joined: Jun 26, 2002
Posts: 11
Hi, There,
I need to recursively call SQL to retrieve data which have inhert relationships. Then display the data into JTree. I don't need the tree to be balanced or ordered, but definitely not binary.
And the JTree need to be manipulated a lot while keeping the hierarchy of the tree.
Does anyone have recommendation on what Data Structure I should use to store the data returned from Database? Or should I just write my own tree structure?
Thanks a lot!!
Nina
Brian McCallister
Greenhorn

Joined: Dec 03, 2002
Posts: 19
From the sound of it you will probably be best off creating your own model behind this data - especially if you are loading it dyanmically, then make a TreeModel interface to your model that can make sense of it for the JTree.
-Brian
Nina Wang
Greenhorn

Joined: Jun 26, 2002
Posts: 11
Thanks, Brian!
I am not planning to load it dynamicly, because the data would possibly be huge. I feel it would be better to let the GUI user wait at the very beginning instead of waiting for every click. How do you think?
Also do you think it would be better for the performance if I use XML to store the recursively SQL result then java data structure?
Thank!
Nina
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Data Structure for displays in JTree?