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

/*
<APPLET
    CODE = treedata.class
    WIDTH = 350
    HEIGHT = 280>
</APPLET>
*/

public class treedata extends JApplet 
{
    Hashtable hashtable = new Hashtable();
    Hashtable subhashtable = new Hashtable();
    Hashtable subsubhashtable = new Hashtable();

    String[] strings = new String[] {"Item 1", "Item 2", 
        "Item 3", "Item 4", "Item 5"};

    public void init() 
    {
        Container contentPane = getContentPane();

        hashtable.put("Items", strings);
        hashtable.put("Subitems", subhashtable);

        subhashtable.put("Items", strings);
        subhashtable.put("Item 1", new Integer(1));
        subhashtable.put("Item 2", new Integer(2));
        subhashtable.put("Item 3", new Integer(3));
        subhashtable.put("Items with subitems", subsubhashtable);

        subsubhashtable.put("Yet more subitems", strings);
        subsubhashtable.put("Item 1", new Integer(1));
        subsubhashtable.put("Item 2", new Integer(2));
        subsubhashtable.put("Item 3", new Integer(3));

        JTree hashTree = new JTree(hashtable);

        JScrollPane hashPane = new JScrollPane(hashTree);

        hashTree.expandPath(new TreePath(hashTree.getModel().getRoot()));    

        contentPane.add(hashPane);
    }
}

