ConcentricCircles - // Paints several concentric circles of...

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

View Full Document Right Arrow Icon
//******************************************************************** // ConcentricCircles.java Author: Lewis and Loftus // // Solution to Programming Project 3.23 //******************************************************************** / import javax.swing.JApplet; import java.awt.*; i public class ConcentricCircles extends JApplet { private final int NUM_CIRCLES = 10; private final int MIN_RADIUS = 5; private final int MAX_RADIUS = 140; private final int CENTER_X = 150; private final int CENTER_Y = 150; //-----------------------------------------------------------------
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: // Paints several concentric circles of random radius. //-----------------------------------------------------------------public void paint(Graphics page) { int radius, x, y; setBackground (Color.black); page.setColor (Color.green); for (int count=1; count <= NUM_CIRCLES; count++) { radius = (int) (Math.random() * MAX_RADIUS) + MIN_RADIUS; x = CENTER_X - radius; y = CENTER_Y - radius; page.drawOval (x, y, radius*2, radius*2); } } }...
View Full Document

This note was uploaded on 05/17/2011 for the course COP 3530 taught by Professor Davis during the Spring '08 term at University of Florida.

Ask a homework question - tutors are online