国际会展实务书籍:帮忙改下JAVA程序,怎么不能运行

来源:百度文库 编辑:高考问答 时间:2024/04/30 10:11:55
package thread;
import java.awt.*;
import java.awt.event.*;

public class Mutative {
public static void main(String args[]){
Mywin win=new Mywin();
win.pack();
}
}
class Mywin extends Frame implements Runnable {
Button b=new Button("ok");
int x=5;
Thread thread=null;
Mywin(){
setBounds(100,100,200,200);
setLayout(new flowlayout());
setVisible(true);
add(b);
b.setBackground(Color.green);
addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);
}
});
Thread=new Thread(this);
thread.start();
}
public void run()
{
while(true){
x=x+1;
if(x>100)
x=5;
b.setBounds(40,40,x,x);
try{
Thread.sleep(200);

}catch(InterruptedException e){
}
}
}
}

有什么提示,或者什么效果没有,这样不好看