/* mCircle.java */ import java.awt.*; public class mTriangle extends mRectangle { public mTriangle(int _x, int _y, int _w, int _h) { /* call mRectangle's constructor */ super(_x, _y, _w, _h); } public void paint(Graphics g) { /* draw triangle */ int xx[] = { x, x+w, x+w/2}; int yy[] = { y+h, y+h, y}; g.setColor(color); g.fillPolygon(xx, yy, 3); } }