FileDocCategorySizeDatePackage
PolygonFill.javaAPI DocExample508Sat Jun 24 20:09:48 BST 2000None

PolygonFill.java

import java.awt.*;

/** Fill a Polygon */
public class PolygonFill extends Component {
	/** The points we draw */
	Polygon p;

	public void paint(Graphics g) {
		g.setColor(Color.black);
		g.drawPolygon(p);
		g.setColor(Color.gray);
		g.fillPolygon(p);
	}

	/** Construct the drawing object */
	public PolygonFill() {
		p = new Polygon();
		// make a triangle.
		p.addPoint(0,100);
		p.addPoint(200,0);
		p.addPoint(200,200);
	}
	public Dimension getPreferredSize() {
		return new Dimension(210, 210);
	}
}