[1].[文件] Polygon10.html ~ 81B    下载(3) 跳至 [1] [2] [3]

<html>
<applet code="Polygon10.class" width="600" height="600">
</applet>
</html>

[2].[文件] Polygon10.java ~ 571B    下载(7) 跳至 [1] [2] [3]

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);
	   }
	}
}

[3].[图片] 12_Triangles.png 跳至 [1] [2] [3]