// CSE 142 Lecture 6 // More Parameters, Graphics import java.awt.*; // For Graphics and Color // Draws the different staircase examples from class. // Demonstrates changing the position and width of // figures based on the loop counter. public class Stairs { public static void main(String[] args) { DrawingPanel panel = new DrawingPanel(500, 140); Graphics g = panel.getGraphics(); // blue stairs (far left) g.setColor(Color.BLUE); for (int i = 0; i < 10; i++) { g.drawRect(20 + 10 * i, 20 + 10 * i, 100 - 10 * i, 10); } // red stairs (second from left) g.setColor(Color.RED); for (int i = 0; i < 10; i++) { g.drawRect(230 - 10 * i, 20 + 10 * i, 10 + 10 * i, 10); } // green stairs (second from right) g.setColor(Color.GREEN); for (int i = 0; i < 10; i++) { g.drawRect(260, 20 + i * 10, 100 - 10 * i, 10); } // orange stairs (far right) g.setColor(Color.ORANGE); for (int i = 0; i < 10; i++) { g.drawRect(380, 20 + i * 10, 10 + i * 10, 10); } } }