public static @Nullable TreePath getPathForLocation(@NotNull JTree tree, int x, int y) {
    TreePath path = tree.getClosestPathForLocation(x, y);
    Rectangle bounds = tree.getPathBounds(path);
    return bounds != null && bounds.y <= y && y < bounds.y + bounds.height ? path : null;
  }
public static @Nullable TreePath getPathForLocation(@NotNull JTree tree, int x, int y)