File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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?
It is sorta covered in the JavaRanch Style Guide.
subject: Data Structure for displays in JTree?
Similar Threads
Data Structure for display in JTree?
JTree with CheckBox
Editing JTree Custom Model
How to recursively traverse JTree?