This discussion is archived
2 Replies Latest reply: Jan 7, 2013 3:25 AM by Kayaman RSS

How do I add children to the nodes?

945290 Newbie
Currently Being Moderated
My parent is declared as vector.
How do I declare a children.


package test;

import java.awt.Container;
import java.util.Vector;
import javax.swing.JFrame;
import javax.swing.JTree;

public class TestTree extends JFrame{
public static void main(String [] args){
Vector concepts = new Vector();
TestTree tree = new TestTree();
}
public TestTree(){
super("Concepts and SubConcepts Testing");
Container content = getContentPane();
Vector concepts = new Vector();
concepts.add("Protein");
concepts.add("Gene_Expression");
concepts.add("Binding");
concepts.add("Phosopholation");
concepts.add("Regulation");
concepts.add("Negative_regulation");
JTree tree = new JTree(concepts);
content.add(tree);
setSize(275, 400);
setVisible(true);
}
}

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points