import java.awt.*;
public class java{
public static void main(String args[]){
Frame w=new Frame();
w.setSize(1024, 768);
w.setBackground(Color.black);
MyStar mp=new MyStar();
w.add(mp);
Thread t=new Thread(mp);
t.start();
w.setVisible(true);
}
}
class MyStar extends Panel implements Runnable{
int x[]=new int[600];
int y[]=new int[600];
int LXx=30;
int LXy=30;
int LXd=30;
private int size = 5;
private Point weizhi = new Point((int)(Math.random()*1024),(int)(Math.random()*768));
MyStar(){
for(int i=0;i<600;i++){
x[i]=(int)(Math.random()*1024);
y[i]=(int)(Math.random()*768);
}
}
public void paint(Graphics g){
g.setColor(Color.yellow);
g.fillOval(800,100, 100, 100);
g.setColor(Color.black);
g.fillOval(830,70, 100, 100);
for(int i=0;i<300;i++){
g.setColor(new Color((int)(Math.random()*255),(int)(Math.random()*255),(int)(Math.random()*255)));
g.drawString("*", x[i], y[i]);
}
for(int i=1;i
g.drawString("*", LXx++, LXy++);
}
super.paint(g);
g.setColor(new Color(100,200,100));
g.fillOval(weizhi.x,weizhi.y,14*size,14*size);
//yanjing
g.setColor(Color.WHITE);
g.fillOval(weizhi.x+3*size,weizhi.y+3*size,3*size,3*size);
g.fillOval(weizhi.x+9*size,weizhi.y+3*size,3*size,3*size);
g.setColor(Color.BLACK);
int sign = (int) (Math.signum(size - Math.random()*20));
g.fillOval(weizhi.x+4*size+sign*size,weizhi.y+3*size,1*size,1*size);
g.fillOval(weizhi.x+10*size+sign*size,weizhi.y+3*size,1*size,1*size);
//sigejiao(240,30)
g.setColor(new Color(10,200,10));
int zou = (weizhi.x + weizhi.y)%2;
g.fillOval(weizhi.x-16*size,weizhi.y+17*size + zou*size,12*size,10*size);//zoushang
g.fillOval(weizhi.x+16*size,weizhi.y+17*size - zou*size,12*size,10*size);//youshang
g.fillOval(weizhi.x-16*size,weizhi.y+42*size - zou*size,12*size,10*size);//zuoxia
g.fillOval(weizhi.x+16*size,weizhi.y+42*size + zou*size,12*size,10*size);//youxia
//weiba
g.setColor(new Color(100,200,100));
g.fillOval(weizhi.x+4*size,weizhi.y+50*size- zou*size,4*size - zou*size,10*size + zou*size);
//shenti
g.setColor(Color.BLACK);
g.fillOval(weizhi.x-9*size,weizhi.y+12*size,30*size,40*size);
g.setColor(Color.GREEN);
g.fillOval(weizhi.x-8*size,weizhi.y+13*size,28*size,38*size);
//乌龟背上的花纹
g.setColor(Color.BLACK);
int pax = (int)Math.round(15*size*Math.sin(Math.PI/6));
int pay = (int)Math.round(20*size*Math.cos(Math.PI/6));
int qax = (int)Math.round(8*size*Math.sin(Math.PI/6));
int qay = (int)Math.round(10*size*Math.cos(Math.PI/6));
Point[] p = new Point[7];
Point[] q = new Point[7];
p[0] = new Point(weizhi.x + 6*size - pax, weizhi.y + 32*size - pay);
p[1] = new Point(weizhi.x + 6*size + pax, weizhi.y + 32*size - pay);
p[2] = new Point(weizhi.x + 6*size + 15*size,weizhi.y + 32*size);
p[3] = new Point(weizhi.x + 6*size + pax, weizhi.y + 32*size + pay);
p[4] = new Point(weizhi.x + 6*size - pax, weizhi.y + 32*size + pay);
p[5] = new Point(weizhi.x + 6*size - 15*size,weizhi.y + 32*size);
p[6] = p[0];
q[0] = new Point(weizhi.x + 6*size - qax, weizhi.y + 32*size - qay);
q[1] = new Point(weizhi.x + 6*size + qax, weizhi.y + 32*size - qay);
q[2] = new Point(weizhi.x + 6*size + 8*size,weizhi.y + 32*size);
q[3] = new Point(weizhi.x + 6*size + qax, weizhi.y + 32*size + qay);
q[4] = new Point(weizhi.x + 6*size - qax, weizhi.y + 32*size + qay);
q[5] = new Point(weizhi.x + 6*size - 8*size,weizhi.y + 32*size);
q[6] = q[0];
for(int i = 0;i<6;i++){
g.drawLine(p[i].x,p[i].y,q[i].x,q[i].y);
g.drawLine(q[i].x,q[i].y,q[i+1].x,q[i+1].y);
}
}
public void run(){
while(true){
LXx=(int)(Math.random()*1024);
LXy=(int)(Math.random()*768);
LXd=(int)(Math.random()*200);
weizhi = new Point((int)(Math.random()*1024),(int)(Math.random()*768));
try{
Thread.sleep(400);
}catch(Exception e){};
repaint();
}
}
}