Hello Tree (cont’d)
DefaultMutableTreeNode root = new DefaultMutableTreeNode("Root");
DefaultMutableTreeNode[] nodes = new DefaultMutableTreeNode[20];
treeModel = new DefaultTreeModel(root);
tree = new JTree(treeModel);
nodes[i] = new DefaultMutableTreeNode
(strLeaves[i%strLeaves.length]+i);
DefaultMutableTreeNode temp=root;
.substring(0,(strLeaves[strLeaves.length-1].length()))
.equals(strLeaves[strLeaves.length-1])) {
treeModel.insertNodeInto(nodes[i], root, 0);
treeModel.insertNodeInto(nodes[i], temp, 0);
getContentPane().add(tree, BorderLayout.CENTER);