Tree editor

A JTree is composed of nodes, each representing a data item. Because nodes can contain other nodes (its children) you can create hierarchical views of your data. All nodes of a JTree descend from one single node, the root node.

The Edit Tree dialog opens when you double-click a JTree.


The Tree Editor dialog

The tree displayed in the dialog is a copy of the original tree with the same TreeCellRenderer and same values for the rootVisible and showsRootHandles properties.
Add node: If a node is currently selected, adds a new node as the last child of the selected node. If no node is currently selected, adds a new node as the last child of the root node.
Insert node: Inserts a new node after the one which is currently selectd.
Remove node: Removes the selected node.
Edit CellRenderer: For one or more selected nodes you can set the displayed .
Remove CellRenderer: For one or more selected nodes you can remove a prviously defined cell renderer.
Clear selection: Deselects any selected node.
OK: Copies changes to the original tree (including the tree's selection state and expanded state).
Cancel: Closes the dialog without changing the original tree.

Note: The TreeCellRenderer you can define in this dialog is useful only for static tree data and for sketching layouts. A TreeCellEditor will not reflect changes in the TreeCellRenderer.

See also:
Internationalization