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); } } }
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; }