wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes Draw binary tree structure Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Draw binary tree structure" Watch "Draw binary tree structure" New topic
Author

Draw binary tree structure

sachin upatil
Greenhorn

Joined: May 17, 2010
Posts: 29
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

Joined: Jun 06, 2007
Posts: 93
Have you tried if JTree or swingx.JXTree suits your needs.. or can be customized?


SCJP 5.0
sachin upatil
Greenhorn

Joined: May 17, 2010
Posts: 29
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

Joined: May 17, 2010
Posts: 29
I tried it using for loop but it not working. it's showing complete tree.

which is any other option i can try ?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Draw binary tree structure