randomcircle - GOval circle = new GOval(temp,temp);

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
import acm.graphics.*; import acm.program.*; import acm.util.*; import java.awt.*; public class randomcircle extends GraphicsProgram{ public void run(){ for(int i=0;i<10;i++) createcircle(); } private RandomGenerator rgen = RandomGenerator.getInstance(); private void createcircle(){ double temp=2*rgen.nextDouble(5,50);
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: GOval circle = new GOval(temp,temp); circle.setLocation(rgen.nextDouble(0, getWidth()-temp), rgen.nextDouble(0, getHeight()-temp)); Color tempcolor=rgen.nextColor(); circle.setColor(tempcolor); circle.setFillColor(tempcolor); circle.setFilled(true); add(circle); } }...
View Full Document

This note was uploaded on 10/25/2010 for the course CS 106A taught by Professor Sahami,m during the Fall '08 term at Stanford.

Ask a homework question - tutors are online