boolean (@NotNull MouseEvent e, int clickCount) { TreePath path = myTree.getClosestPathForLocation(e.getX(), e.getY()); Rectangle bounds = path == null ? null : myTree.getPathBounds(path); if (bounds == null || bounds.x > e.getX() || bounds.y > e.getY() || bounds.y + bounds.height < e.getY()) return false; navigateSelectedElement(); return true; }