import java.util.*;
import javax.swing.*;
import javax.swing.tree.*;
import java.awt.*;

public class TreeSample extends JPanel {

  public TreeSample() {
	super();	

 	// Create the tree structure
	DefaultMutableTreeNode top = new DefaultMutableTreeNode("The root of all");
	DefaultMutableTreeNode primo = 
	   new  DefaultMutableTreeNode ("The First Node");
	top.add(primo);
	primo.add(new DefaultMutableTreeNode ("The first in the first"));
	primo.add(new DefaultMutableTreeNode ("The second in the first"));

	DefaultMutableTreeNode second =
	   new  DefaultMutableTreeNode ("The Second Node");
	top.add(second);
	second.add(new DefaultMutableTreeNode ("The first in the second"));
	second.add(new DefaultMutableTreeNode ("The second in the second"));

        DefaultMutableTreeNode category = 
	   new  DefaultMutableTreeNode ("Category");
	second.add(category);
	category.add(new DefaultMutableTreeNode("Bussines"));
	category.add(new DefaultMutableTreeNode ("Science"));
	
	JTree tree = new JTree(top);
        JScrollPane scrollpane = new JScrollPane(tree);

        //Lay out the content pane.
        setLayout(new BorderLayout());
	setPreferredSize(new Dimension(350,300));
	add("Center", scrollpane);
   }
   public static void main (String args[]) {
	TreeSample app = new TreeSample();
	JFrame frame = new JFrame ("My Application");
	frame.setContentPane(app);
	frame.pack();
	frame.show();
   }
}


         
