TreeModel mod = tree.getModel();
  Object[] getPathToRoot(Object node, int depth)  {    TreeModel mod = tree.getModel();    if (node == null)      {        if (depth == 0)          return null;                return new Object[depth];      }    Object[] path = getPathToRoot(getParent(mod.getRoot(), node), depth + 1);    path[path.length - depth - 1] = node;    return path;  }