Javatpoint Logo
Javatpoint Logo

Java JTree

The JTree class is used to display the tree structured data or hierarchical data. JTree is a complex component. It has a 'root node' at the top most which is a parent for all nodes in the tree. It inherits JComponent class.

JTree class declaration

Let's see the declaration for javax.swing.JTree class.

Commonly used Constructors:

Constructor Description
JTree() Creates a JTree with a sample model.
JTree(Object[] value) Creates a JTree with every element of the specified array as the child of a new root node.
JTree(TreeNode root) Creates a JTree with the specified TreeNode as its root, which displays the root node.

Java JTree Example

Output:

JAVA Jtree 1
Next TopicJava JColorChooser




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


B.Tech / MCA