真么没有人回答我的问题啊;呜呜

zxf_2000 2002-12-11 11:04:46
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;

public class RollingMessage extends java.applet.Applet implements Runnable
{
Thread runThread;
String s="Welcome to here!";
int s_length=s.length();
int x_character=0;
Font wordFont=new Font("TimesRoman",Font.BOLD,50);

public void start()
{
if(runThread!=null)
{
runThread=new Thread(this);
runThread.start();
}

}
public void stop()
{
if(runThread!=null)
{
runThread.stop();
runThread=null;
}
}
public void run()
{
while(true)
{
if(x_character++>s_length)
x_character=0;
repaint();
try
{
Thread.sleep(300);

}
catch(InterruptedException e)
{

}
}
}
public void paint(Graphics g)
{
g.setFont(wordFont);
g.setColor(Color.red);
g.drawString(s.substring(0,x_character),8,50);
}
}
错误:
Note: D:\j2sdk1.4.1\demo\applets\test\RollingMessage.java uses or overrides a deprecated API.
Note: Recompile with -deprecation for details.
这是什么意思啊;
...全文
27 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
zxf_2000 2002-12-11
  • 打赏
  • 举报
回复
thank you very much
gavin1976 2002-12-11
  • 打赏
  • 举报
回复
重新带参数编译:
javac -deprecation RollingMessage.java
他会告诉你runThread.stop()这个方法现在在1.4版本已经不用了,不过编译还是能通过,并能执行。
现在一般都用interrupt(),而不用stop().
139129 2002-12-11
  • 打赏
  • 举报
回复
使用 -deprecation参数重新编译一遍
Shooter 2002-12-11
  • 打赏
  • 举报
回复
使用了过期的API函数吧,你找找看,和JDK的API文档对对

62,614

社区成员

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

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