import java.awt.*;
import java.applet.*;
public class Roll extends Applet implements Runnable
{
String msg="我的程序";
boolean stopflag;
Thread t;
public void init()
{
t=null;
}
public void start()
{
t=new Thread(this);
stopflag=false;
t.start();
}
public void run()
{while(true)
{
repaint();try
{
Thread.sleep(1000);
} catch (InterruptedException e)
{e.printStackTrace();
}
msg=msg.substring(1, msg.length())+msg.charAt(0);if (stopflag==true)
break;
}
}
public void stop()
{
stopflag=true;
t=null;}
public void paint(Graphics g)
{
g.drawString(msg, 50, 30);
showStatus(msg);
}}
我期望的运行结果应该是“我的程序”这几个字滚动
但是运行的时候根本就不动
高手指点为什么
import java.applet.*;
public class Roll extends Applet implements Runnable
{
String msg="我的程序";
boolean stopflag;
Thread t;
public void init()
{
t=null;
}
public void start()
{
t=new Thread(this);
stopflag=false;
t.start();
}
public void run()
{while(true)
{
repaint();try
{
Thread.sleep(1000);
} catch (InterruptedException e)
{e.printStackTrace();
}
msg=msg.substring(1, msg.length())+msg.charAt(0);if (stopflag==true)
break;
}
}
public void stop()
{
stopflag=true;
t=null;}
public void paint(Graphics g)
{
g.drawString(msg, 50, 30);
showStatus(msg);
}}
我期望的运行结果应该是“我的程序”这几个字滚动
但是运行的时候根本就不动
高手指点为什么
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货