IntelliJ Java IDE
The moose likes Swing / AWT / SWT / JFace and the fly likes How to get the bounds of a node in JTree Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT / JFace
Reply Bookmark "How to get the bounds of a node in JTree" Watch "How to get the bounds of a node in JTree" New topic
Author

How to get the bounds of a node in JTree

Nagarajan Thangapandi
Greenhorn

Joined: Mar 18, 2008
Posts: 9
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
Saloon Keeper

Joined: Jul 26, 2007
Posts: 7602

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.

[Donate a pint, save a life!] [How to ask questions]
Rob Spoor
Saloon Keeper

Joined: Oct 27, 2005
Posts: 18365

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
 
IntelliJ Java IDE
 
subject: How to get the bounds of a node in JTree
 
Threads others viewed
JTree
JTree
JTree
JTree
JTree
IntelliJ Java IDE