All pastes #270732 Raw Edit

Mine

public text v1 · immutable
·published 2006-12-07 17:49 UTC
rendered paste body
// Lab06st
// Student version of the Lab06 assignment.

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


public class lab06 extends Applet
{

	public void paint(Graphics g)
	{
		Random rand = new Random();
		int x1,y1,x2,y2,c1,c2,c3;

		// Draw Grid
		g.drawRect(9,9,780,580);
		g.drawLine(389,9,389,589);
		g.drawLine(9,289,789,289);

		// Draw Black Lines
		for(int n = 0;n<100;n++)
		{
			x1 = rand.nextInt(381)+9;
			x2 = rand.nextInt(381)+9;
			y1 = rand.nextInt(281)+9;
			y2 = rand.nextInt(281)+9;
			g.drawLine(x1,y1,x2,y2);
		}
		// Draw Colored Lines
		for(int n = 0;n<100;n++)
		{
			x1 = rand.nextInt(381)+389;
			x2 = rand.nextInt(381)+389;
			y1 = rand.nextInt(281)+9;
			y2 = rand.nextInt(281)+9;
			c1 = rand.nextInt(256);
			c2 = rand.nextInt(256);
			c3 = rand.nextInt(256);
			g.setColor(new Color(c1,c2,c3));
			g.drawLine(x1,y1,x2,y2);
		}
		// Draw Colored Squares
		for(int n = 0;n<100;n++)
		{
			x1 = rand.nextInt(331)+9;
			y1 = rand.nextInt(231)+289;
			c1 = rand.nextInt(256);
			c2 = rand.nextInt(256);
			c3 = rand.nextInt(256);
			g.setColor(new Color(c1,c2,c3));
			g.fillRect(x1,y1,50,50);
		}
		// Draw UnSolid Cube
		g.setColor(Color.red);
		g.fillRect(550,400,100,100);


		Polygon side1 = new Polygon();
		side1.addPoint(500,350);
		side1.addPoint(550,400);
		side1.addPoint(550,500);
		side1.addPoint(500,450);
		g.setColor(Color.green);
		g.fillPolygon(side1);

		Polygon side2 = new Polygon();
		side2.addPoint(650,400);
		side2.addPoint(600,400);
		side2.addPoint(600,350);
		g.setColor(Color.blue);
		g.fillPolygon(side2);

		Polygon side3 = new Polygon();
		side3.addPoint(600,400);
		side3.addPoint(600,350);
		side3.addPoint(500,350);
		side3.addPoint(550,400);
		g.setColor(Color.yellow);
		g.fillPolygon(side3);

	}
}