首页上一页 1 下一页尾页 1 条记录 1/1页
求教哈!
发表在Java图书答疑
2009-06-25
是否精华
是
否
版块置顶:
是
否
import java.awt.Graphics;
import java.awt.Font;
import java.awt.Color;
public class RollingMessage extends java.applet.Applet implements Runnable
{
Thread runThread;
String s="Welcome to China!";
int s_length=s.length();
int x_character=0;
Font wordFont=new Font("TimesRoman",Font.BOLD,50);
public void start()
{
if(runThread==null)
{
Thread 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);
}
}
此代码中的S如果设置为"欢迎来到JAVA世界"时,在D:\java 下运行 javac RollingMessage.java 时出现
Note:RollingMessage.java uses or overrides a deprecated API
Note:Recompile with -deprecation for details
老师,请问这是怎么回事啊?
import java.awt.Font;
import java.awt.Color;
public class RollingMessage extends java.applet.Applet implements Runnable
{
Thread runThread;
String s="Welcome to China!";
int s_length=s.length();
int x_character=0;
Font wordFont=new Font("TimesRoman",Font.BOLD,50);
public void start()
{
if(runThread==null)
{
Thread 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);
}
}
此代码中的S如果设置为"欢迎来到JAVA世界"时,在D:\java 下运行 javac RollingMessage.java 时出现
Note:RollingMessage.java uses or overrides a deprecated API
Note:Recompile with -deprecation for details
老师,请问这是怎么回事啊?