package Nodepad;

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

/**
 * LList.java
 *
 *
 * Created: Mon Dec 16 15:04:06 2002
 *
 * @author <a href="mailto:shapiro@cse.buffalo.edu">Stuart C. Shapiro</a>
 * @version
 *
 * An applet that provides a sketchpad for nodes whose values are integers.
 *
 */
public class LList extends JApplet {
    ButtonPanel panel;
    Pad pad;

    /** 
     * Initializes this LList with a button panel and a node sketchpad.
     */
    public void init() {
	Container cp = getContentPane();
	pad = new Pad();
	panel = new ButtonPanel(pad);
	cp.add(panel,BorderLayout.NORTH);
	cp.add(pad,BorderLayout.CENTER);

	// Pad Contents
	ListNode firstln = new ListNode(pad,10,200,(int)(Math.random()*1000));
	int dist = firstln.getTotalWidth();
	pad.add(firstln);
	for (int i = 1; i < 5; i++) {
	pad.add(new ListNode(pad,i*dist+10,200,(int)(Math.random()*1000)));
	}
	pad.add(new ListNode(pad,3*dist+10,400,(int)(Math.random()*1000)));
	pad.add(new PointerNode(pad,3*dist+10,540,"o"));
	pad.add(new PointerNode(pad,10,340,"Lst"));
	pad.add(new PointerNode(pad,2*dist+10,340,"p"));
    }

    /**
     * Repaints this LList.
     */
    public void start() {
	repaint();
    }    
		 
} // LList
