Java JTree Model setTreeObjects(TreeModel in, Object root, Object[] items, int index)

Here you can find the source of setTreeObjects(TreeModel in, Object root, Object[] items, int index)

Description

return the objects in a tree modes as a simple array

License

Apache License

Parameter

Parameter Description
in - the tree model

Return

- index of first unused access

Declaration

protected static int setTreeObjects(TreeModel in, Object root, Object[] items, int index) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import javax.swing.tree.*;

public class Main {
    /**/*  w  ww .j  a  v  a2  s  .  com*/
    return the objects in a tree modes as a simple array
    @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 setTreeObjects(TreeModel in, Object root, Object[] items, int index) {
        items[index++] = root;
        for (int i = 0; i < in.getChildCount(root); i++)
            index = setTreeObjects(in, in.getChild(root, i), items, index);
        return (index);
    }
}

Related

  1. logTreeNodes(TreeModel model, Object node, String indent)
  2. nodesChanged(DefaultTreeModel rightTreeModel)
  3. redrawAllTreeCells(DefaultTreeModel treeModel)
  4. redrawAllTreeCellsRec(DefaultTreeModel treeModel, TreeNode parent)
  5. searchPath(TreeModel model, TreePath oldPath)
  6. setTreePaths(TreeModel in, Object root, TreePath[] items, Object[] path, int index)
  7. showTreeComponent(String blank, TreeModel model, Object node)