很简单的问题:新手请教,解决后给分

eureka0891 2003-03-27 02:43:12
javac Animator.java

Note:Animator.java uses or overrides a deprecated API.
Note:Recompile with -deprecation for details.

这是什么错?解决方法是什么?

Animator.java清单如下:

import java.awt.*;
import java.util.Vector;

public class Animator extends java.applet.Applet implements Runnable {
Vector images;
int imgNumber;
int currentImage=1;
Thread thisThread;

public void init(){
//Read in the number of images in the animation
imgNumber = new Integer(getParameter("imgNumber")).intValue();

//Load the images
for (int x=0;x<imgNumber;x++){
Image img = getImage(getDocumentBase(),"images/img"+(x+1));
images.addElement(img);
}
}

public void paint(Graphics g){
g.drawImage((Image)images.elementAt(currentImage++),0,0,null);
currentImage%=imgNumber;
}

public void update(Graphics g){
paint(g);
}

public void start(){
thisThread = new Thread(this);
thisThread.start();
}

public void stop(){
thisThread.stop();
}

public void run(){
while(true){
try{
thisThread.sleep(100);
}
catch (Exception e){}
}
}
}
...全文
36 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
eric_uugames 2003-04-03
  • 打赏
  • 举报
回复
我是一个初学者,这个问题我见过

这是因为你使用了一个你的当前JDK推荐部使用(部推荐使用)的方法。
javac -deprecation Animator.java

系统会告诉你,不推荐使用的方法是哪一个,然后你自己想办法绕道而行吧 8-)
eureka0891 2003-03-27
  • 打赏
  • 举报
回复
谢谢,
不过我照着做
http://docs.rinet.ru:8083/UJ11/ch14.htm
上的Animator Applet
怎么没成功?
zhaoweiemail 2003-03-27
  • 打赏
  • 举报
回复
这是一个警告,不影响程序。
Bruce_1981 2003-03-27
  • 打赏
  • 举报
回复
加上 import java.applet.Applet;

62,614

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧