GCT1015
java图形图像——绘制多边形// 程序:绘制多边形// 范例文件:DrawPolygon.javaimport java.awt.*;import java.applet.*;public class DrawPolygon extends Applet {int X[] = {10,180,90,110,130,50}; //顶点X坐标int Y[] = {15,55,95,115,135,180}; //顶点Y坐标public void paint(Graphics g){g.drawPolygon(X,Y,6); //绘制六边形}}drawPolygon()方法使用三个参数,前两个参数为两个坐标点数组,第三个参数为坐标点的个数