import java.applet.*;
import java.awt.*;
// This applet draws a polygon using an array of points
public class DrawPoly2 extends Applet {
// Define an array of X coordinates for the polygon
int xCoords[] = { 10, 40, 60, 30, 10 };
// Define an array of Y coordinates for the polygon
int yCoords[] = { 20, 0, 10, 60, 40 };
Polygon P=new Polygon(xCoords,yCoords,5);
public void paint(Graphics g) {
// 5 points in polygon
g.fillPolygon(P);
}
}