Here you can find the source of saveTreeSelection(JTree tree)
public static TreePath[] saveTreeSelection(JTree tree)
//package com.java2s; //License from project: Apache License import javax.swing.JTree; import javax.swing.tree.TreePath; public class Main { public static TreePath[] saveTreeSelection(JTree tree) { return tree == null ? null : tree.getSelectionPaths(); }/*from w ww . j av a2 s . co m*/ }