code: public static void collapseJTree(javax.swing.JTree tree, int depth) {
          javax.swing.tree.TreeModel model = tree.getModel();
          collapseJTreeNode(tree, model, model.getRoot(), 0, depth);
      }
docs: Expands all nodes in a JTree.
  
  @param tree The JTree to expand.
  @param depth The depth to which the tree should be expanded.  Zero
  will just expand the root node, a negative value will
  fully expand the tree, and a positive value will
  recursively expand the tree to that depth.