Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   Upside down pyramid JTree? (http://www.velocityreviews.com/forums/t391025-upside-down-pyramid-jtree.html)

RC 02-21-2007 09:15 PM

Upside down pyramid JTree?
 
Currently when you construct a JTree, it is a
pyramid tree (root on top, branch nodes on bottom).
Is possible make JTree upside down pyramid tree (root
on bottom, branch nodes on top)?

Thanks!

Sundar 02-22-2007 08:46 AM

Re: Upside down pyramid JTree?
 
On Feb 22, 2:15 am, RC <raymond.c...@nospam.noaa.gov> wrote:
> Currently when you construct a JTree, it is a
> pyramid tree (root on top, branch nodes on bottom).
> Is possible make JTree upside down pyramid tree (root
> on bottom, branch nodes on top)?
>
> Thanks!


I dont think its possible with jTree. I never came across such method/
setting in jTree. Here is the reference:
http://java.sun.com/j2se/1.4.2/docs/...ing/JTree.html


-Sundar
http://heysundar.blogspot.com


Rogan Dawes 02-22-2007 09:58 AM

Re: Upside down pyramid JTree?
 
RC wrote:
> Currently when you construct a JTree, it is a
> pyramid tree (root on top, branch nodes on bottom).
> Is possible make JTree upside down pyramid tree (root
> on bottom, branch nodes on top)?
>
> Thanks!


You would need to do some custom coding, but it probably wouldn't be
*that* difficult. I would look at the drawing code (paintComponent?),
and see how it does its calculations.

Then, rather than starting from an origin of (0,0), and adding offsets
to figure out where to render nodes, start by calculating the height of
your tree, then use that height and subtract offsets to figure out where
to paint the nodes.

Regards,

Rogan


All times are GMT. The time now is 09:03 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.