public static void expandAll(final JTree tree, final boolean expand) {
    final TreeNode root = (TreeNode) tree.getModel().getRoot();

    // Traverse tree from root
    expandAll(tree, new TreePath(root), expand);
  }
Tests whether a tree contains a given node.

@param tree The tree to search.
@param node The node to search for.
@return True, if the node is part of the tree. False, otherwise.
java/zylib/src/main/java/com/google/security/zynamics/zylib/gui/jtree/TreeHelpers.java