[Logo] JavaRanch » JavaRanch Saloon
  Search | FAQ | Recent Topics | Hot Topics
Register / Login


Reply Bookmark it! Watch this topic JavaRanch » Forums » Java » Swing / AWT / SWT / JFace
 
RSS feed
 
New topic
Author

How to get the bounds of a node in JTree

Nagarajan Thangapandi
Greenhorn

Joined: Mar 18, 2008
Messages: 3

I need to get bounds of a node in the JTree. Can some one tell me how to get that.

Thanks in advance.
Maneesh Godbole
Bartender

Joined: Jul 26, 2007
Messages: 4244

Nagarajan,
Welcome to the Ranch.

The DefaultMutableTreeNode i.e. the "node" represents the data. What you see on the screen, will be the renderer.
Once you identified your node, you will have to figure out the corresponding renderer and then get it's bounds.

work is the scourge of the drinking class
Rob Prime
Bartender

Joined: Oct 27, 2005
Messages: 8841

Check out the JTree API. There are two methods that return a Rectangle; both start with "get" and end with "Bounds()".

SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
 
 
 
Reply Bookmark it! Watch this topic JavaRanch » Forums » Java » Swing / AWT / SWT / JFace
 
RSS feed
 
New topic
The most intelligent Java IDE

.