The following text was written to the standard output stream when the Invention2 program was executed from Netbeans.
/*
* Invention2
*/
package npw;
import java.awt.Color;
import java.util.Random;
import painter.SPainter;
import shapes.SRectangle;
/**
*
* @author dmaslows
*/
public class Invention2 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
SPainter me = new SPainter("Invention2", 800, 800);
int sideLength = 700;
int decrement = (sideLength /40);
Color a = randomColor();
Color b = randomColor();
SRectangle s = new SRectangle(sideLength, 400);
int i = 1;
while (s.perimeter() > 0) {
if (i % 2 == 1) {
me.setColor(a);
} else {
me.setColor(b);
}
me.paint(s);
me.tl(20);
s.shrink(decrement, decrement);
i = i + 1;
}
}
private static Color randomColor() {
Random rgen = new Random();
int r = rgen.nextInt(256);
int g = rgen.nextInt(256);
int b = rgen.nextInt(256);
return new Color(r, b, g);
}
}