How can I get the coordinates of a node (JLabel,image, ..) on a JTree?
Sandip Chitale Use any one of the following methods to get rectangular bounds of a cell -
public Rectangle getRowBounds(int row) Returns the Rectangle that the node at the specified row is drawn in. Parameters: row - the row to be drawn, where 0 is the first row in the display Returns: the Rectangle the node is drawn in public Rectangle getPathBounds(TreePath path) Returns the Rectangle that the specified node will be drawn into. Returns null if any component in the path is hidden (under a collapsed parent). Note: This method returns a valid rectangle, even if the specified node is not currently displayed. Parameters: path - the TreePath identifying the node Returns: the Rectangle the node is drawn in, or null
rectangle.x and rectangle.y should give you the coordinates relative to the tree.