
class Demo
{
   public static void main(String args[])
   {
      Graphics g = new Graphics();	// Create canvas for drawing
      g.drawBorder();

      Point p1 = new Point(5,6), p2 = new Point(10,6), 
            p3 = new Point(15,1), p4 = new Point(15,16);

      Quadrilateral q = new Quadrilateral(p1, p2, p3, p4);
 
      q.paint( g );        // Draw Quadrilateral q on grid g
 
      g.show();

      // Drawing stick figures

      Graphics h = new Graphics();	// Create a second canvas

      Polygon[] stickFigure = new Polygon[7];

      Rectangle head = new Rectangle( new Point(20,5), 6, 11 );
      stickFigure[0] = head;

      Line neck = new Line( new Point(25,11), new Point(25,14) );
      stickFigure[1] = neck;

      Square body = new Square( new Point(18,14), 15 );
      stickFigure[2] = body;

      Line leftArm = new Line( new Point(18,17), new Point(6,29) );
      stickFigure[3] = leftArm;

      // Right arm consists of two lines
      Line rightHArm = new Line( new Point(33,17), new Point(38,17) );
      Line rightVArm = new Line( new Point(38,17), new Point(38,11) );
      stickFigure[4] = rightHArm;
      stickFigure[5] = rightVArm;

      Line leftLeg = new Line( new Point(23,29), new Point(11,41) );
      stickFigure[6] = leftLeg;

      for (int i = 0; i < 7; i++)	// Paint figure onto canvas
         stickFigure[i].paint( h );	// using polymorphism

      h.show();				// Display canvas
   }
}
