Here you can find the source of expandAllNodes(JTree tree, int startingIndex, int rowCount)
public static void expandAllNodes(JTree tree, int startingIndex, int rowCount)
//package com.java2s; //License from project: LGPL import javax.swing.JTree; public class Main { public static void expandAllNodes(JTree tree) { expandAllNodes(tree, 0, tree.getRowCount()); }//from www.ja va 2s . c o m public static void expandAllNodes(JTree tree, int startingIndex, int rowCount) { for (int i = startingIndex; i < rowCount; ++i) { tree.expandRow(i); } if (tree.getRowCount() != rowCount) { expandAllNodes(tree, rowCount, tree.getRowCount()); } } }