/* TestDrawFigures.java        Authors: Koffman & Wolz
 * Draws a collection of geometric objects stored in an array.
 * Uses GeoFigure, Triangle, Rectangle, Circle, Drawable,
 * DrawableRectangle, DrawableCircle,  DrawableTriangle,
 * and awt.
 */
import java.awt.*;
import java.applet.Applet;

public class TestDrawFigures extends Applet {

  public void paint(Graphics g) {
    // Create an array of type GeoFigure
       GeoFigure gf[] = {
          new DrawableRectangle(100, 100, new Point (0,0),
                                Color.blue, Color.green),
          new DrawableRectangle(100, 200, new Point (100,100),
                                Color.red, Color.yellow),
          new Triangle(10, 20),
          new DrawableRectangle(50, 100, new Point (200,300),
                                Color.black, Color.red),
          new DrawableCircle(30, new Point(300,200),
                             Color.orange, Color.gray),
          new DrawableTriangle(40, 60,
                               new Point(300,300),
                               Color.black, Color.magenta) };

      // Draw the drawable objects.
      for (int i = 0; i < gf.length; i++) {
         if (gf[i] instanceof Drawable)
           ((Drawable) gf[i]).drawMe(g);
      }
  }
 
}

