Java examples for Swing:JTree
Creating a JTree Component
import javax.swing.JTree; import javax.swing.tree.DefaultMutableTreeNode; public class Main { public void main() { DefaultMutableTreeNode root = new DefaultMutableTreeNode("Root Label"); root.add(new DefaultMutableTreeNode("Node Label")); JTree tree = new JTree(root); }/*from ww w . ja v a 2 s . c om*/ }