展开指定节点
public void expandTreeNode(JTree aTree, DefaultMutableTreeNode aNode) {
    if (aNode.isLeaf()) {
      return;
    }
    aTree.expandPath(new TreePath( ( (DefaultMutableTreeNode) aNode).getPath()));
    int n = aNode.getChildCount();
    for (int i = 0; i < n; i++) {
      expandTreeNode(aTree, (DefaultMutableTreeNode) aNode.getChildAt(i));
    }
  }
折叠指定节点及其所有子节点
public void collapseTreeNode(JTree aTree, DefaultMutableTreeNode aNode) {
    if (aNode.isLeaf()) {
      return;
    }
    aTree.collapsePath(new TreePath( ( (DefaultMutableTreeNode) aNode).getPath()));
    int n = aNode.getChildCount();
    for (int i = 0; i < n; i++) {
      collapseTreeNode(aTree, (DefaultMutableTreeNode) aNode.getChildAt(i));
    }
  }