This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Creating JTree On Run TIme

 
Kinu Kanwar
Ranch Hand
Posts: 33
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a data in this form

int node [] = 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8
int parent[] = -1 , 0 , 0 , 1 , 1 , 3 , 3 , 2 , 2

For example

node[A] = X
parent[A] = parent of X

and I ahve to draw Tree depending on relation b/w two arrays .... Any help is appreciated ...

Regards

Kinu Kanwar
 
Stuart Gray
Ranch Hand
Posts: 410
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think something like this should work:




Here is some Java code (I haven't tested it though):

This assumes that nodes is an array of TreeNodes, which you could achieve like this:
 
Kinu Kanwar
Ranch Hand
Posts: 33
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its not working :-(

Kinu
 
Stuart Gray
Ranch Hand
Posts: 410
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Doesn't compile or doesn't run? Whats the error or problem you are getting?
 
Craig Wood
Ranch Hand
Posts: 1535
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic