• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to store & retrieve the content of JTree to & from the database

 
Rose ---
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
my question is how to retireve the data from the database
after that the data should be display as a Jtree format.
first i stored the data into the database from the JTree.
tree contains
parent child leaf eg.
p
p1
p11
p111
p112
p12

p2
p21
p221
p222
p22

like that from the above tree
parent contains
2 subnode p1,p2
p1 contains p11,p12
p11 contains two leaves p111,p112
p2 is empty
and so on.
i stored sucessfully
i used vector to retrieve also
after that i am not able to dispaly the data as tree
the tree is not binary tree
it will have more than one level.
if u have idea reply me.
thankz in advance.

by
Rose.

[ February 03, 2006: Message edited by: Rose --- ]

[ February 04, 2006: Message edited by: Rose --- ]
[ February 04, 2006: Message edited by: Rose --- ]
 
John Wetherbie
Rancher
Posts: 1449
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Rose ---",

Please review the JavaRanch Naming Policy and change your display name. You may do that here.
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I recall responding to a similar posting of yours, but it seems to have disappeared. Again, there are two things to understand here: a JTree's TreeModel and how to save and retieve this data. Step one would be to forget about the database and just make sure you understand how TreeModel works. Have you read Sun's tutorial, concentrating on when they discuss JTree's TreeModel?

http://java.sun.com/docs/books/tutorial/uiswing/components/tree.html

You write about storing data in a Vector, which might (might!) be an intermediate form of your tree's data, but which isn't sufficient.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!