package shears;

import java.applet.*;
import java.awt.*;

import psplot.*;
import real.*;

class Shear0Canvas extends ShearCanvas {
	
	public Shear0Canvas(Applet e, int w, int h,
		double B, double Ht, double S) {
		super(e, w, h, B, Ht, S);
		mkFixedPaths();
		repaint();
	}
	
	PlotPath rectangle;
	PlotPath top;
	PlotPath bottom;
	
	void mkFixedPaths() {
		rectangle = new PlotPath(this);
		top = new PlotPath(this);
		bottom = new PlotPath(this);
		
		rectangle.moveto(0,0);
		rectangle.lineto(0,ht);
		rectangle.lineto(b,ht);
		rectangle.lineto(b,0);
		rectangle.close();
		
		top.moveto(-4.5,ht);
		top.lineto(6.5,ht);

		bottom.moveto(-4.5,0);
		bottom.lineto(6.5,0);
	}
	
	public void draw() {
		boolean ready = false;
		top.stroke(Color.black);
		bottom.stroke(Color.black);

		rectangle.fill(Color.cyan);
		rectangle.stroke(Color.black);
		
		PlotPath parallelogram = new PlotPath(this);
		parallelogram.moveto(0,0);
		parallelogram.lineto(b,0);
		parallelogram.lineto(b+s,ht);
		parallelogram.lineto(s,ht);
		parallelogram.close();
		
		parallelogram.fill(Color.blue);
		parallelogram.stroke(Color.black);
		cn.draw();
		ready = true;
	}
	
}

// ------------------------------------------------------

public class Shear0Applet extends ShearApplet {
	
	public void init() {
		setLayout(new BorderLayout(0, 0));
		setBackground(Color.white);
		pic = new Shear0Canvas(this, bounds().width, bounds().height,
			b, h, s);
		add(pic);
		show();
	}
	
}
