A friendly place for Java greenhorns!
Java
Ranch
»
JavaRanch Saloon
Search
|
FAQ
|
Recent Topics
|
Hot Topics
Register
/
Login
Java
Ranch
»
Forums
»
Java
»
Swing / AWT / SWT / JFace
Author
How to get the bounds of a node in JTree
Nagarajan Thangapandi
Greenhorn
Joined: Mar 18, 2008
Messages: 3
posted
Feb 09, 2010 06:38:22
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
posted
Feb 09, 2010 07:16:35
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
posted
Feb 09, 2010 13:03:41
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
Java
Ranch
»
Forums
»
Java
»
Swing / AWT / SWT / JFace
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
.