Here you can find the source of restoreExpanstionState(JTree tree, int row, String expansionState)
public static void restoreExpanstionState(JTree tree, int row, String expansionState)
//package com.java2s; //License from project: MIT License import java.util.StringTokenizer; import javax.swing.JTree; public class Main { public static void restoreExpanstionState(JTree tree, int row, String expansionState) { StringTokenizer stok = new StringTokenizer(expansionState, ","); while (stok.hasMoreTokens()) { int token = row + Integer.parseInt(stok.nextToken()); tree.expandRow(token);/* w ww . j a va 2 s.c o m*/ } } }