DefaultTreeModel model = (DefaultTreeModel)hostTree.getModel(); DefaultMutableTreeNode root = (DefaultMutableTreeNode)model.getRoot(); TreePath path = null; Enumeration nodes = root.breadthFirstEnumeration(); while (nodes.hasMoreElements()) { DefaultMutableTreeNode node = (DefaultMutableTreeNode)nodes.nextElement(); if (node.getUserObject() instanceof ConsoleTreeObject) { ConsoleTreeObject cto = (ConsoleTreeObject)node.getUserObject(); if (cto.isNode()) { if (cto.getName().equals(nodeName)) { path = new TreePath(node.getPath()); break; } } } } if (path != null) hostTree.setSelectionPath(path);
selectNodeInTree(hostTree, HostComponent.class, nodeName);
  public void selectNodeInHostTree(String nodeName) {    DefaultTreeModel model = (DefaultTreeModel)hostTree.getModel();    DefaultMutableTreeNode root =       (DefaultMutableTreeNode)model.getRoot();    TreePath path = null;    Enumeration nodes = root.breadthFirstEnumeration();    while (nodes.hasMoreElements()) {      DefaultMutableTreeNode node =  	(DefaultMutableTreeNode)nodes.nextElement();        if (node.getUserObject() instanceof ConsoleTreeObject) {          ConsoleTreeObject cto = (ConsoleTreeObject)node.getUserObject();          if (cto.isNode()) {            if (cto.getName().equals(nodeName)) {              path = new TreePath(node.getPath());              break;            }          }        }    }    if (path != null)      hostTree.setSelectionPath(path);  }