HTML TREE 04 - Hands-On - Activity - 1
HTML TREE 04 - Hands-On - Activity - 1
HTML Tree
Objective:
Expected Output:
Part 2 (Week 9)
4. Using Java methods and println(), enumerate the following:
4.1. Root node
4.2. Parent nodes
4.3. Siblings
4.4. One-level subtrees
4.5. Nodes per level
4.6. Depth
4.7. Degree of each one-level subtree
4.8.List of nodes based on breadth-first, preorder, and postorder
CODE:
package com.mycompany.htmltree;
import java.util.Collections;
import javax.swing.*;
import javax.swing.tree.DefaultMutableTreeNode;
public HtmlTree() {
frame = new JFrame();
System.out.print("Siblings: ");
siblings(root);
System.out.println(" \n");
frame.add(tree);
frame.setTitle("JTree Example");
frame.setSize(300, 300);
frame.setVisible(true);
}
if (node.isLeaf()) {
return;
}
}
}
if (node.isLeaf()) {
return;
}
}
}
if (node.isLeaf()) {
return;
}
}
}
if (node.isLeaf()) {
return;
}
}
}
if (node.isLeaf()) {
return;
}
}
}
}
OUTPUT: