getClosestPathForLocation
public abstract TreePath getClosestPathForLocation?( JTree tree, int x, int y)
Returns the path to the node that is closest to x,y. If there is nothing currently visible this will return null, otherwise it'll always return a valid path. If you need to test if the returned object is exactly at x, y you should get the bounds for the returned path and test x, y against that.
- Parameters:
-
tree - a JTree object
-
x - an integer giving the number of pixels horizontally from the left edge of the display area
-
y - an integer giving the number of pixels vertically from the top of the display area, minus any top margin
- Returns:
- the
TreePath node closest to x,y or null if there is nothing currently visible
|
|