{ int row = path.getPathCount(); if (tree.isVisible(path)) return row;  path = path.getParentPath(); while (row > 0 && !tree.isVisible(path))
{ int row = 0; Object dest = path.getLastPathComponent(); Object curr = treeModel.getRoot(); while (curr != null && !curr.equals(dest))
	public int getRowForPath(JTree tree, TreePath path)	{    int row = path.getPathCount();    if (tree.isVisible(path))      return row;        path = path.getParentPath();    while (row > 0 && !tree.isVisible(path))      {        path = path.getParentPath();        row--;      }    return row;	}