private void expandAllNodes(JTree tree,TreePath parentPath){
  TreeNode node=(TreeNode)parentPath.getLastPathComponent();
  for (int i=0; i < node.getChildCount(); i++) {
    expandAllNodes(tree,parentPath.pathByAddingChild(node.getChildAt(i)));
  }
  tree.expandPath(parentPath);
}

private void expandAllNodes ( JTree tree , TreePath parentPath ) { TreeNode node = ( TreeNode ) parentPath . getLastPathComponent ( ) ; for ( int i = 0 ; i < node . getChildCount ( ) ; i ++ ) { expandAllNodes ( tree , parentPath . pathByAddingChild ( node . getChildAt ( i ) ) ) ; } tree . expandPath ( parentPath ) ; }
recursive method to expand all the nodes of a tree .
