ParallelLines - // Paints several parallel lines of random...

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

View Full Document Right Arrow Icon
//******************************************************************** // ParallelLines.java Author: Lewis and Loftus // // Solution to Programming Project 3.20 //******************************************************************** / import javax.swing.JApplet; import java.awt.*; i public class ParallelLines extends JApplet { private final int NUM_LINES = 20; private final int MIN_LENGTH = 25; private final int MAX_EXTRA = 250; private final int START_X = 10; private final int GAP = 8; //-----------------------------------------------------------------
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 parallel lines of random length. //-----------------------------------------------------------------public void paint(Graphics page) { int y = 5, length; setBackground (Color.black); page.setColor (Color.green); for (int count=1; count <= NUM_LINES; count++) { y += GAP; length = (int) (Math.random() * MAX_EXTRA) + MIN_LENGTH; page.drawLine (START_X, y, START_X+length, y); } } }...
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