Java Reference
In-Depth Information
public void insertNodeInto(MutableTreeNode child, MutableParentNode parent,
index int) : Adds the child node to parent's set of children at the child position index
(zero-based).
public void removeNodeFromParent(MutableTreenode node) : Causes the node to be
removed from tree.
public void nodeChanged(TreeNode node) : Notifies the model that a node has changed.
public void nodesChanged(TreeNode node, int childIndices[]) : Notifies the model
that the child or children of a node have changed.
public void nodeStructureChanged(TreeNode node) : Notifies the model if the node and
children have changed.
public void nodesWereInserted(TreeNode node, int childIndices[]) : Notifies the
model that nodes were inserted as children of the tree node.
public void nodesWereRemoved(TreeNode node, int childIndices[], Object
removedChildren[]) : Notifies the model that child nodes were removed from the tree
and includes nodes as arguments in the method call.
public void reload() / public void reload(TreeNode node) : Notifies the model that
there were complex changes made to the nodes and that the model should be reloaded
from the root node down or from a specific node down.
The first pair of methods is for directly adding or removing nodes to or from a tree. The
remaining methods are for notifying the data model when tree nodes are modified. If you don't
insert or remove nodes into or from the model for a displayed tree with one of the first two
methods, it's your responsibility to call a method from the second set.
TreeModelListener Interface and TreeModelEvent Class
The TreeModel uses a TreeModelListener to report any changes to the model. When the
TreeModel sends a TreeModelEvent , any registered listeners are notified. The interface includes
notification methods for when nodes are inserted, removed, or changed, as well as one catchall
method for when some or all of these operations are done simultaneously.
public interface TreeModelListener implements EventListener {
public void treeNodesChanged(TreeModelEvent treeModelEvent);
public void treeNodesInserted(TreeModelEvent treeModelEvent);
public void treeNodesRemoved(TreeModelEvent treeModelEvent);
public void treeStructureChanged(TreeModelEvent treeModelEvent);
}
TreeSelectionModel Interface
In addition to all trees supporting a data model for storing nodes, a renderer for displaying
nodes, and an editor for editing them, there is a data model called TreeSelectionModel for
selective manipulation of tree elements. The TreeSelectionModel interface that follows contains
Search WWH ::




Custom Search