This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
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

Data Structure for displays in JTree?

Nina Wang

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!!
Brian McCallister

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.
Nina Wang

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?
I agree. Here's the link:
subject: Data Structure for displays in JTree?
It's not a secret anymore!