/*************************************************************************
 * Open Source Beta Code
 * @(#)DrawAxes.java
 * Math: The Cartesian Plane and Graph of y = x
 * Lnk2Lrn Code Lab
 * @author Dr. Persin
 * @version 1.00 2011/3/30
 *************************************************************************/
import java.awt.*;
import javax.swing.*;
public class DrawAxes extends JPanel
{
	int left = 550;
    int top = 360;
 
public void paint(Graphics g) {
	// Translate the origin
	g.translate(left, top);
	
	// Draw Axes.
	g.drawLine(0, 350, 0, -350);
	g.drawLine(-500, 0, 500, 0);
	int x = 0;
	int y = 0;
	while (x<300)
	{g.drawLine(-x,y,x+1,-(y+1));
		try {
				Thread.sleep(10);
			} catch(InterruptedException e) {}
		x++;y=x;
		}
	
	// translate back.
	g.translate(-left, -top);
    
}


	public static void main(String[] args)
	{
		DrawAxes drawAxes = new DrawAxes();
		JFrame frame = new JFrame("Draw Axes");
		frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		frame.getContentPane().add(drawAxes);
		frame.setSize(1100,750);
		frame.setBackground (Color.cyan);
		frame.setVisible(true);
	}
}	
