Point (JTree tree) { TreePath path = tree.getSelectionPath(); Rectangle bounds = tree.getPathBounds(path); int x = tree.getVisibleRect().width + 5; return bounds == null ? new Point(x, 10) : new Point(x, (int)bounds.getCenterY()); }