1 /* 2 * File: MyPolygon.java 3 * 4 * MyPolygon class 5 * 6 * Copyright: Northeast Parallel Architectures Center 7 * 8 */ 9 10 import java.awt.Polygon; 11 import java.awt.Graphics; 12 import java.awt.Point; 13 14 class MyPolygon extends Polygon { 15 16 // Instance methods: 17 public void draw( Graphics g ) { 18 g.drawPolygon( this ); 19 } 20 public void fill( Graphics g ) { 21 g.fillPolygon( this ); 22 } 23 24 // Overload Polygon.addPoint( int, int ): 25 public void addPoint( Point p ) { 26 super.addPoint( p.x, p.y ); 27 } 28 29 }