import java.awt.*; /** * Draws two tall rectangles * * R. Rosebrugh * 2002/9/10 */ public class Towers { // dimensions private int x1, y1, h1, w1, x2,y2,h2,w2 ; private String color; /** * Constructor for objects of class Towers */ public Towers() { // initialize x1 = 50; y1 = 100; h1 = 110; w1 = 500; x2 = 250; y2 = 100; h2 = 110; w2 = 500; color="black"; draw(); } /* * Draw the towers with current specifications on screen. */ private void draw() { Canvas canvas = Canvas.getCanvas(); canvas.setForegroundColour(color); canvas.fill(new Rectangle(x1, y1, h1, w1)); canvas.wait(10); canvas.fill(new Rectangle(x2, y2, h2, w2)); canvas.wait(10); } }