示例#1
0
 public void add(DefaultMutableTreeNode novo, ArrayList<TreePath> st) {
   Enumeration e = novo.postorderEnumeration();
   while (e.hasMoreElements()) {
     DefaultMutableTreeNode node = (DefaultMutableTreeNode) e.nextElement();
     TreePath p = new TreePath(node.getPath());
     if (!st.contains(p)) {
       st.add(p);
     }
   }
 }
示例#2
0
  public DefaultMutableTreeNode find(DefaultMutableTreeNode root, String name) {

    // TODO: fix this... we must search by column!

    if (root == null) {
      return null;
    }
    Enumeration e = root.postorderEnumeration();
    while (e.hasMoreElements()) {
      DefaultMutableTreeNode node = (DefaultMutableTreeNode) e.nextElement();
      if (((String) node.getUserObject()).equals(name)) {
        return node;
      }
    }
    return null;
  }