Trees : Tree « SWT « Java Tutorial

SWT uses two classes, Tree and TreeItem, to implement tree controls.

Creating Trees

public Tree(Composite parent, int style)

Trees can allow either a single selection or multiple selections.

Tree Styles

SWT.SINGLEAllows only one item in the tree to be selected at a time. This is the default.
SWT.MULTIAllows multiple items in the tree to be selected at the same time.
SWT.CHECKDisplays a checkbox to the left of each of the root items in the tree.

17.57.2.Create a TreeCreate a Tree
17.57.3.Populate tree lazilyPopulate tree lazily
17.57.4.Create Three Level TreeCreate Three Level Tree
17.57.5.Insert TreeItem to TreeInsert TreeItem to Tree
17.57.6.Add checkbox mark to the tree nodeAdd checkbox mark to the tree node
17.57.7.A multiselection treeA multiselection tree
17.57.8.A single-selection treeA single-selection tree