急!急!急!用线程实现一行字滚动的applet小程序 利用多线程技术编写applet程序,其中包含一个滚动的字符串.字符串从左向右移动,当所有的字符都从屏幕的右边消失后,字符串重新从左边出现并继续向右移动. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 public class ParamBanner extends Applet implements Runnable {String msg;Thread t = null;int state;boolean stopFlag;// Set colors and initialize thread.public void init() {setBackground(Color.cyan);setForeground(Color.red);}// Start threadpublic void start() {msg = getParameter("message");if(msg == null) msg = "Message not found.";msg = " " + msg;t = new Thread(this);stopFlag = false;t.start();}// Entry point for the thread that runs the banner.public void run() {char ch;// Display bannerfor( ; ; ) {try {repaint();Thread.sleep(250);ch = msg.charAt(0);msg = msg.substring(1, msg.length());msg += ch;if(stopFlag)break;} catch(InterruptedException e) {}}}// Pause the banner.public void stop() {stopFlag = true;t = null;}// Display the banner.public void paint(Graphics g) {g.drawString(msg, 50, 30);}} import java.awt.*;import java.applet.*;/*<applet code="ParamBanner" width=300 height=50><param name=message value="Java makes the Web move!"></applet>*/ java面试---机试题 很急啊,两个小程序,求答案啊 这个错误怎么解决,急急急!!! 二维数组应用问题 这段代码帮忙分析一下 java异常 linux下如何通过jdbc访问access数据库文件? 在线求助高手?点菜单里的某一按钮,相应事件出JProgress,代码看内容 提问,紧急提问~~~ 文件我已经建立了,为什么总返回false?? 急!jbuilder中怎样生成excel文件或报表文件并将数据存入数据库中?在线等! 怎样重玩游戏
String msg;
Thread t = null;
int state;
boolean stopFlag;
// Set colors and initialize thread.
public void init() {
setBackground(Color.cyan);
setForeground(Color.red);
}
// Start thread
public void start() {
msg = getParameter("message");
if(msg == null) msg = "Message not found.";
msg = " " + msg;
t = new Thread(this);
stopFlag = false;
t.start();
}
// Entry point for the thread that runs the banner.
public void run() {
char ch;
// Display banner
for( ; ; ) {
try {
repaint();
Thread.sleep(250);
ch = msg.charAt(0);
msg = msg.substring(1, msg.length());
msg += ch;
if(stopFlag)
break;
} catch(InterruptedException e) {}
}
}
// Pause the banner.
public void stop() {
stopFlag = true;
t = null;
}
// Display the banner.
public void paint(Graphics g) {
g.drawString(msg, 50, 30);
}
}
import java.applet.*;
/*
<applet code="ParamBanner" width=300 height=50>
<param name=message value="Java makes the Web move!">
</applet>
*/