void () { if (myAutoCollapseTargets) { final DefaultMutableTreeNode root = (DefaultMutableTreeNode)myTreeModel.getRoot(); for (int i = 0; i < root.getChildCount(); i++) { final DefaultMutableTreeNode node = (DefaultMutableTreeNode)root.getChildAt(i); myTree.collapsePath(new TreePath(node.getPath())); } } }