哪个高手帮小妹``一把啊``急死了
import java.applet.*; import java.awt.*;
public class Bounce extends Applet implements Runnable{
double x,y,xChange,yChange;
double xLimit=300;
double yLimit=300;
Thread ball;
public void init(){
setBackground(Color.white);
xChange=Math.random();
yChange=Math.random();
x=Math.random()*xLimit;
y=Math.random()*yLimit;
}
public void start(){
if(ball==null){
ball=new Thread(this);
ball.start();
}
}
public void stop(){
if(ball!=null){
ball.stop();
ball=null;
}
}
public void run(){
while(true){
x+=xChange;
y+=yChange;
if((x>=xLimit||x<=0))xChange=-xChange;
if(y>=yLimit||y<=0)yChange=-yChange;
repaint();
try{
Thread.sleep(1);
}catch(InterruptedException e){}
}
}
public void pain(Graphics g){
g.setColor(Color.green);
g.fillOval((int)x,(int)y,20,20);
}
}
编译后:
Note: Bounce.java uses or overrides a deprecated API.
Note: Recompile with -deprecation for details.
为什么会出现这种情况啊```