| Package | Description | 
|---|---|
| javax.swing | Provides a set of "lightweight"
(all-Java language) components that,
to the maximum degree possible, work the same on all platforms. | 
| javax.swing.tree | Provides classes and interfaces for dealing with
 javax.swing.JTree. | 
| Modifier and Type | Class and Description | 
|---|---|
| static class  | JTree.DynamicUtilTreeNodeDynamicUtilTreeNodecan wrap
 vectors/hashtables/arrays/strings and
 create the appropriate children tree nodes as necessary. | 
| Modifier and Type | Class and Description | 
|---|---|
| class  | DefaultMutableTreeNodeA  DefaultMutableTreeNodeis a general-purpose node in a tree data
 structure. | 
| Modifier and Type | Field and Description | 
|---|---|
| protected MutableTreeNode | DefaultMutableTreeNode. parentthis node's parent, or null if this node has no parent | 
| Modifier and Type | Method and Description | 
|---|---|
| void | DefaultMutableTreeNode. add(MutableTreeNode newChild)Removes  newChildfrom its parent and makes it a child of
 this node by adding it to the end of this node's child array. | 
| void | MutableTreeNode. insert(MutableTreeNode child,
      int index)Adds  childto the receiver atindex. | 
| void | DefaultMutableTreeNode. insert(MutableTreeNode newChild,
      int childIndex)Removes  newChildfrom its present parent (if it has a
 parent), sets the child's parent to this node, and then adds the child
 to this node's child array at indexchildIndex. | 
| void | DefaultTreeModel. insertNodeInto(MutableTreeNode newChild,
              MutableTreeNode parent,
              int index)Invoked this to insert newChild at location index in parents children. | 
| void | MutableTreeNode. remove(MutableTreeNode node)Removes  nodefrom the receiver. | 
| void | DefaultMutableTreeNode. remove(MutableTreeNode aChild)Removes  aChildfrom this node's child array, giving it a
 null parent. | 
| void | DefaultTreeModel. removeNodeFromParent(MutableTreeNode node)Message this to remove node from its parent. | 
| void | MutableTreeNode. setParent(MutableTreeNode newParent)Sets the parent of the receiver to  newParent. | 
| void | DefaultMutableTreeNode. setParent(MutableTreeNode newParent)Sets this node's parent to  newParentbut does not
 change the parent's child array. | 
 Submit a bug or feature 
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
 Copyright © 1993, 2025, Oracle and/or its affiliates.  All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.