This section illustrates you how to create a tree.
SWT allows an advantage of creating a tree. To represent the data in the hierarchical way, the class Tree is used. It provides the hierarchy of items.
The constructor of class Tree consists of shell and the style value. The class TreeItem represents the hierarchy of tree items in a tree by adding an item to the tree. Its constructor consists of parent, style value and the index.
The method setText() sets the text specified.
Here is the code of CreateTree.java
Output will be displayed as
Liked it! Share this Tutorial