javax.swing.tree
Class DefaultTreeModel

A simple tree data model that uses TreeNodes.
For further information and examples that use DefaultTreeModel,
see How to Use Trees
in The Java Tutorial.

Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing. As of 1.4, support for long term storage
of all JavaBeansTM
has been added to the java.beans package.
Please see XMLEncoder.

root

listenerList

asksAllowsChildren

protected boolean asksAllowsChildren

Determines how the isLeaf method figures
out if a node is a leaf node. If true, a node is a leaf
node if it does not allow children. (If it allows
children, it is not a leaf node, even if no children
are present.) That lets you distinguish between folder
nodes and file nodes in a file system, for example.

If this value is false, then any node which has no
children is a leaf node, and any node may acquire
children.

getChild

Returns the child of parent at index index in the parent's
child array. parent must be a node previously obtained from
this data source. This should not return null if index
is a valid index for parent (that is index >= 0 &&
index < getChildCount(parent)).

valueForPathChanged

This sets the user object of the TreeNode identified by path
and posts a node changed. If you use custom user objects in
the TreeModel you're going to need to subclass this and
set the user object of the changed node to something meaningful.

insertNodeInto

Invoked this to insert newChild at location index in parents children.
This will then message nodesWereInserted to create the appropriate
event. This is the preferred way to add children as it will create
the appropriate event.

nodesWereRemoved

Invoke this method after you've removed some TreeNodes from
node. childIndices should be the index of the removed elements and
must be sorted in ascending order. And removedChildren should be
the array of the children objects that were removed.