Java tutorial
//package com.java2s; import javax.swing.JTree; import javax.swing.tree.TreePath; public class Main { public static String getNameNodoAtIndex(int ind, JTree jtree) { TreePath parentPath = jtree.getSelectionPath(); int level = 0; if (parentPath != null) { level = parentPath.getPathCount(); } return "" + parentPath.getPathComponent(ind); } }