// CSE 142, Summer 2008 (Marty Stepp) // This program draws stacks of rectangles using DrawingPanel and for loops. import java.awt.*; // so that I can use Graphics public class DrawLoops { public static void main(String[] args) { DrawingPanel panel = new DrawingPanel(400, 500); Graphics g = panel.getGraphics(); // right-aligned, increasing in width for (int i = 0; i < 10; i++) { g.drawRect(100 - 10 * i, // x 20 + 10 * i, // y 10 + 10 * i, // width 10); // height } /* // left-aligned, decreasing in width for (int i = 0; i < 10; i++) { g.drawRect(20, // x 20 + 10 * i, // y 100 - 10 * i, // width 10); // height } // right-aligned, decreasing in width for (int i = 0; i < 10; i++) { g.drawRect(20 + 10 * i, // x 20 + 10 * i, // y 100 - 10 * i, // width 10); // height } */ } }