TreeModel mod = tree.getModel();
  private Object findNode(Object root, Object node)  {    TreeModel mod = tree.getModel();    int size = 0;    if (!mod.isLeaf(root))      size = mod.getChildCount(root);    for (int i = 0; i < size; i++)      {        if (mod.getIndexOfChild(root, node) != -1)          return root;        Object n = findNode(mod.getChild(root, i), node);        if (n != null)          return n;      }    return null;  }