Here you can find the source of makeLocalFilePath(TreePath treePath)
public static String makeLocalFilePath(TreePath treePath)
//package com.java2s; //License from project: BSD License import javax.swing.tree.TreePath; public class Main { public static String makeLocalFilePath(TreePath treePath) { String filePath = ""; for (Object node : treePath.getPath()) { if (node.toString().equals("/")) continue; filePath += System.getProperty("file.separator") + node.toString(); }//from w w w . java 2 s. co m return filePath; } public static String makeLocalFilePath(TreePath treePath, Object drive) { String filePath = ""; String truncDrive = ""; for (Object node : treePath.getPath()) { if (node.toString().equals("/")) continue; filePath += System.getProperty("file.separator") + node.toString(); } if (drive != null) { truncDrive = drive.toString().substring(0, drive.toString().length() - 1); return truncDrive + filePath; } else { return filePath; } } }