Rainbow - public void paint(Graphics page) { int x =...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
//******************************************************************** // Rainbow.java Author: Lewis and Loftus // // Solution to Programming Project 3.27 //******************************************************************** / import javax.swing.JApplet; import java.awt.*; i public class Rainbow extends JApplet { private final int NUM_COLORS = 5; private final int NUM_ARCS = 20; private final int START_WIDTH = 50; private final int START_HEIGHT = 40; private final int START_X = 150 - START_WIDTH/2; private final int START_Y = 200 - START_HEIGHT/2; //----------------------------------------------------------------- // Paints a rainbow. //-----------------------------------------------------------------
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: public void paint(Graphics page) { int x = START_X, y = START_Y; int width = START_WIDTH, height = START_HEIGHT; setBackground (Color.black); for (int color=1; color <= NUM_COLORS; color++) { switch (color) { case 1: page.setColor (Color.cyan); break; case 2: page.setColor (Color.red); break; case 3: page.setColor (Color.yellow); break; case 4: page.setColor (Color.green); break; case 5: page.setColor (Color.blue); } for (int arcs = 1; arcs <= NUM_ARCS; arcs++) { page.drawArc (x, y, width, height, 0, 180); x--; y--; width += 2; height += 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.

Page1 / 2

Rainbow - public void paint(Graphics page) { int x =...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online