boolean (Tree tree) { boolean anyExpanded = false; for (int i = 0; i < tree.getRowCount(); i++) { TreeNode treeNode = (TreeNode)tree.getPathForRow(i).getLastPathComponent(); if (tree.isCollapsed(i) && !treeNode.isLeaf()) { anyExpanded = true; tree.expandRow(i); break; } } return anyExpanded; }