/* * File: QuadrilateralTest.java * * Drawing quadrilaterals * * Copyright: Northeast Parallel Architectures Center * */ import java.applet.Applet; import java.awt.Graphics; public class QuadrilateralTest extends Applet { // create references to two quadrilaterals: private Quadrilateral quad1, quad2; public void init() { // instantiate a rectangle (a kind of quadrilateral): quad1 = new Quadrilateral( 25, 25, 125, 25, 125, 75, 25, 75 ); // instantiate a parallelogram (another kind of quadrilateral): quad2 = new Quadrilateral( 165, 25, 265, 25, 250, 75, 150, 75 ); } public void paint( Graphics g ) { // draw the first quadrilateral: quad1.draw( g ); // fill the second quadrilateral: quad2.fill( g ); } }