public class SortableTreeNode extends Object implements MutableTreeNode
MutableTreeNode subclass that allows to sort its children.| Constructor and Description |
|---|
SortableTreeNode(boolean allowsChildren)
Creates a new sortable tree node.
|
SortableTreeNode(Object userObject)
Creates a new sortable tree node that contains the given user-defined
object.
|
SortableTreeNode(Object userObject,
boolean allowsChildren)
Creates a new sortable tree node that contains the given user-defined
object.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(MutableTreeNode child)
Adds the given node to this node as a child.
|
Enumeration<?> |
children() |
boolean |
getAllowsChildren() |
TreeNode |
getChildAt(int childIndex) |
int |
getChildCount() |
int |
getIndex(TreeNode node) |
TreeNode |
getParent() |
Object |
getUserObject()
Returns the user-defined object.
|
void |
insert(MutableTreeNode child,
int index) |
boolean |
isLeaf() |
void |
remove(int index) |
void |
remove(MutableTreeNode node) |
void |
removeAll()
Removes all children of this node.
|
void |
removeFromParent() |
void |
setParent(MutableTreeNode newParent) |
void |
setUserObject(Object userObject) |
void |
sort()
Sorts the children of this node.
|
String |
toString() |
public SortableTreeNode(boolean allowsChildren)
allowsChildren - true if this node allows children,
false otherwisepublic SortableTreeNode(Object userObject)
userObject - The user-defined objectpublic SortableTreeNode(Object userObject, boolean allowsChildren)
userObject - The user-defined objectallowsChildren - true if this node allows children,
false otherwisepublic boolean getAllowsChildren()
getAllowsChildren in interface TreeNodepublic TreeNode getChildAt(int childIndex)
getChildAt in interface TreeNodepublic int getChildCount()
getChildCount in interface TreeNodepublic Object getUserObject()
public Enumeration<?> children()
public void add(MutableTreeNode child)
child - The child node to addpublic void insert(MutableTreeNode child, int index)
insert in interface MutableTreeNodepublic void remove(int index)
remove in interface MutableTreeNodepublic void remove(MutableTreeNode node)
remove in interface MutableTreeNodepublic void removeFromParent()
removeFromParent in interface MutableTreeNodepublic void removeAll()
public void setParent(MutableTreeNode newParent)
setParent in interface MutableTreeNodepublic void setUserObject(Object userObject)
setUserObject in interface MutableTreeNodepublic void sort()
Copyright © 2026. All rights reserved.