if (treeModel != null && currentVisiblePath != null) { Object[] nodes = currentVisiblePath.getPath(); if (row < nodes.length) return new TreePath(getPathToRoot(nodes[row], 0)); } return null;
return treeState.getPathForRow(row);
  public TreePath getPathForRow(JTree tree, int row)  {    if (treeModel != null && currentVisiblePath != null)      {        Object[] nodes = currentVisiblePath.getPath();        if (row < nodes.length)          return new TreePath(getPathToRoot(nodes[row], 0));      }    return null;  }