// CSE 142, Spring 2010, Marty Stepp // This program draws several square boxes at various coordinates. // It demonstrates drawing with loops and parameters. import java.awt.*; // for Graphics public class Boxes { public static void main(String[] args) { DrawingPanel panel = new DrawingPanel(500, 300); Graphics g = panel.getGraphics(); // i y // 0 140 // 1 110 // 2 80 for (int i = 0; i < 5; i++) { // x, y, w, h g.drawRect(10 + 30*i, 140 - 30*i, 30 - 5*i, 30 - 5*i); } } }