[文件] Polygon10.java ~ 571B    下载(7)

import java.awt.*;
import javax.swing.*;

public class Polygon10 extends JApplet {

int x1[]={ 4,   4,  70};  // 右边的三角形顶点坐标
int y1[]={-15,-238,-130};
int x2[]={ -4,  -4, -70}; // 左边的三角形顶点坐标
int y2[]={-15,-238,- 130};
Polygon right = new Polygon(x1,y1,3);// 右边的三角形
Polygon left  = new Polygon(x2,y2,3);// 左边的三角形 
	
  public void paint(Graphics g){
	g.translate(300,300);
	g.setColor(Color.green);
	for (int i=0;i<6;i++){
	g.fillPolygon(right);
	g.fillPolygon(left);
	((Graphics2D)g).rotate(Math.PI/180*60);
	   }
	}
}