Here you can find the source of getPathStringForNode(DefaultMutableTreeNode node)
public static String getPathStringForNode(DefaultMutableTreeNode node)
//package com.java2s; /*L/*from w ww . ja va2s. c o m*/ * Copyright Ekagra Software Technologies Ltd. * Copyright SAIC, SAIC-Frederick * * Distributed under the OSI-approved BSD 3-Clause License. * See http://ncip.github.com/cacore-sdk/LICENSE.txt for details. */ import javax.swing.tree.DefaultMutableTreeNode; public class Main { public static String getPathStringForNode(DefaultMutableTreeNode node) { StringBuilder sb = new StringBuilder(); Object[] path = node.getUserObjectPath(); for (int i = 0; i < path.length; i++) { /*if(path[i] instanceof ElementMetaLoader.MyTreeObject){ Object obj = ((ElementMetaLoader.MyTreeObject)path[i]).getUserObject(); if(obj instanceof ElementMeta){ sb.append("/").append(((ElementMeta)obj).getName()); }else if(obj instanceof AttributeMeta){ sb.append("/@").append(((AttributeMeta)obj).getName()); }else return ""; }else return ""; */ sb.append("/@").append(((String) path[i])); } return sb.toString(); } }