Here you can find the source of resourceFromTreePath(TreePath path)
public static String resourceFromTreePath(TreePath path)
//package com.java2s; //License from project: Open Source License import javax.swing.tree.TreePath; public class Main { public static String resourceFromTreePath(TreePath path) { StringBuilder resource = new StringBuilder(""); if (path.getPathCount() > 1) { for (int i = 2; i < path.getPathCount(); i++) { if (i > 2) { resource.append('/'); }/*from ww w.ja v a 2 s . com*/ resource.append(path.getPathComponent(i).toString()); } } return resource.toString(); } }