读书人

急jtree 遍历,该如何解决

发布时间: 2012-02-09 18:22:27 作者: rapoo

急!jtree 遍历
我想得到指定节点的所有子节点treepath(路径),不是只要节点名称,我该怎么做呢?

[解决办法]

Java code
DefaultMtableTreeNode node = 指定的节点;int chlCount = node.getChildCount();List<TreePath[]> paths = new ArrayList<TreePath[]>();DefaultMtableTreeNode chlNode = null;for(int i = 0; i < chlCount; i++){  chlNode = node.getChildAt(i);  paths.add(chl.getPath());} 

读书人网 >J2SE开发

热点推荐