Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Draw binary tree structure

 
sachin upatil
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello ,

I have created a huffman tree with Node using Comparable interface. working fine.



Also i calculated the depth of tree. and i can travel though tree using following method.



but now i want to display this tree on Jpanel like binary tree as follow :

A
/ \
/ \
B C

How i can achieve this ???
 
Sugantha Jeevankumar
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried if JTree or swingx.JXTree suits your needs.. or can be customized?
 
sachin upatil
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i did it. now i can draw binary tree using following method




But now i want to display this tree node by node using Thread like animation.
 
sachin upatil
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried it using for loop but it not working. it's showing complete tree.

which is any other option i can try ?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic