Exemple #1
0
 // {{{ traverseNodes() method
 public static boolean traverseNodes(
     DefaultMutableTreeNode node, HyperSearchTreeNodeCallback callbackInterface) {
   if (!callbackInterface.processNode(node)) return false;
   for (Enumeration e = node.children(); e.hasMoreElements(); ) {
     DefaultMutableTreeNode childNode = (DefaultMutableTreeNode) e.nextElement();
     if (!traverseNodes(childNode, callbackInterface)) return false;
   }
   return true;
 } // }}}
Exemple #2
0
 @Override
 public void actionPerformed(ActionEvent evt) {
   TreePath path = resultTree.getSelectionPath();
   DefaultMutableTreeNode operNode = (DefaultMutableTreeNode) path.getLastPathComponent();
   for (Enumeration e = operNode.children(); e.hasMoreElements(); ) {
     DefaultMutableTreeNode node = (DefaultMutableTreeNode) e.nextElement();
     resultTree.collapsePath(new TreePath(node.getPath()));
   }
   resultTree.scrollPathToVisible(new TreePath(operNode.getPath()));
 }