当前位置: 代码迷 >> Java相关 >> 十分迷惑``还请教解释啊
  详细解决方案

十分迷惑``还请教解释啊

热度:74   发布时间:2008-09-21 22:56:14.0
十分迷惑``还请教解释啊
import java.awt.*;
public class Bounce extends java.applet.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);
                    }
                    }

编译为何会出现这样的提示啊 ?
注: Bounce.java使用或重写一废弃的API 。

注:重新编译与- deprecation的细节。
搜索更多相关的解决方案: 解释  

----------------解决方案--------------------------------------------------------
肯定里面用了一个很老的方法,这个方法又是不推荐使用的
----------------解决方案--------------------------------------------------------
  相关解决方案