Here you can find the source of setTreePaths(TreeModel in, Object root, TreePath[] items, Object[] path, int index)
Parameter | Description |
---|---|
in | - the tree model |
protected static int setTreePaths(TreeModel in, Object root, TreePath[] items, Object[] path, int index)
//package com.java2s; //License from project: Apache License import javax.swing.tree.*; public class Main { /**/*from w ww .j a v a2 s .co m*/ Fill in an array of TreePaths for the entire tree @param in - the tree model @parem root - starting node - non-null @parem items - array of Objects @parem index - index on entry @return - index of first unused access */ protected static int setTreePaths(TreeModel in, Object root, TreePath[] items, Object[] path, int index) { // build a new path Object[] newPath = new Object[path.length + 1]; System.arraycopy(path, 0, newPath, 0, path.length); newPath[path.length] = root; items[index++] = new TreePath(newPath); for (int i = 0; i < in.getChildCount(root); i++) { index = setTreePaths(in, in.getChild(root, i), items, newPath, index); } return (index); } }