Rectangle () { final JTree tree = getTree(); Rectangle bounds = tree.getVisibleRect(); Rectangle nodeBounds = tree.getPathBounds(getNodePath()); if (bounds == null || nodeBounds == null) { return null; } if (bounds.y > nodeBounds.y || bounds.y + bounds.height < nodeBounds.y + nodeBounds.height) { return null; } bounds.y = nodeBounds.y; bounds.height = nodeBounds.height; if(nodeBounds.x > bounds.x) { bounds.width = bounds.width - nodeBounds.x + bounds.x; bounds.x = nodeBounds.x; } return bounds; }