package cn.test.circle;
import java.awt.Graphics;
public class MyRectangle {
private int x ;
private int y ;
private int w ;
private int h ;
public MyRectangle(int x, int y, int w, int h) {
super();
this.x = x;
this.y = y;
this.w = w;
this.h = h;
new MyRecThread().start();
}
public void drawMe(Graphics g){
g.drawRect(x, y, w, h);
}
private class MyRecThread extends Thread{
@Override
public void run() {
super.run();
while(true){
try {
Thread.sleep(500);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//不断改变属性值
x = (int)(Math.random()*100);
y = (int)(Math.random()*100);
w = (int)(Math.random()*100);
h = (int)(Math.random()*100);
System.out.println("圆的内部在刷新坐标"+x+"--"+y+"---"+w+"---"+h);
}
}
}
}