package Nodepad;

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

/**
 * BSSim.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 BSSim extends JApplet {
    ButtonPanel panel;
    Pad pad;

    /** 
     * Initializes this BSSim 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
	for (int i=0; i<9; i++) {
	pad.add(new Node(pad,i*70+30,150,i)); 
	pad.add(new Node(pad,i*70+30,190,i*100+(int)(Math.random()*100))); 
	}
	
	pad.add(new PointerNode(pad,30,330,"min"));
	pad.add(new PointerNode(pad,310,500,"mid"));
	pad.add(new PointerNode(pad,590,330,"max"));
    }

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