1  /*
  2   *  File:  QuadrilateralTest.java
  3   *
  4   *  Drawing quadrilaterals
  5   *
  6   *  Copyright:  Northeast Parallel Architectures Center
  7   *  
  8   */
  9  
 10  import java.applet.Applet;
 11  import java.awt.Graphics;
 12  
 13  public class QuadrilateralTest extends Applet {
 14  
 15     // create references to two quadrilaterals:
 16     private Quadrilateral quad1, quad2;
 17     
 18     public void init() {
 19     
 20        // instantiate a rectangle (a kind of quadrilateral):
 21        quad1 = new Quadrilateral( 25, 25, 125, 25, 125, 75, 25, 75 );
 22        // instantiate a parallelogram (another kind of quadrilateral):
 23        quad2 = new Quadrilateral( 165, 25, 265, 25, 250, 75, 150, 75 );
 24  
 25     }
 26     
 27     public void paint( Graphics g ) {
 28  
 29        // draw the first quadrilateral:
 30        quad1.draw( g );
 31  
 32        // fill the second quadrilateral:
 33        quad2.fill( g );
 34  
 35     }
 36     
 37  }