资源简介

java所写,红绿灯演示程序,多个线程,供学习J2SE和多线程的参考

资源截图

代码片段和文件信息

package TrafficLight;
import javax.swing.JLabel;//这是一个产生倒计时的泪,构造方法有一个int参数是倒计时的间隔参数,另一个是每轮完毕暂停时间

public class djslabel extends JLabel implements Runnable{
private int jstruejsstopms;
private Thread clockthread=null;
public djslabel(int djsmsint stop){
stopms=stop;
js=djsms;
truejs=djsms;
if(clockthread==null)
clockthread=new Thread(this“clock“);
clockthread.start();
}

public void run(){
do
{while(true&&js>=0)
{
if(js<10)
this.setText(“0“+js+““);
else
this.setText(js+““);
js--;
try{Thread.sleep(1000);}catch(Exception e){}
}
js=truejs;
try{Thread.sleep(1000*(stopms-1));}catch(Exception e){} }
while(true);
}
public Thread getclockthread(){
return clockthread;
}
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      10222  2009-07-14 10:18  红绿灯演示\红绿灯演示.jar

     文件        388  2009-07-13 12:49  红绿灯演示\TrafficLight\.project

     文件        232  2009-07-13 12:49  红绿灯演示\TrafficLight\.classpath

     文件      10222  2009-07-14 10:18  红绿灯演示\TrafficLight\红绿灯演示.jar

     文件        800  2009-07-13 12:54  红绿灯演示\TrafficLight\src\TrafficLight\TimeLabel.java

     文件       4628  2009-07-14 10:17  红绿灯演示\TrafficLight\src\TrafficLight\MyTrafficLight.java

     文件        807  2009-07-14 09:37  红绿灯演示\TrafficLight\src\TrafficLight\djslabel.java

     文件       1686  2009-07-13 12:54  红绿灯演示\TrafficLight\bin\TrafficLight\TimeLabel.class

     文件       5287  2009-07-14 10:17  红绿灯演示\TrafficLight\bin\TrafficLight\MyTrafficLight.class

     文件       1361  2009-07-14 09:37  红绿灯演示\TrafficLight\bin\TrafficLight\djslabel.class

     文件       1586  2009-07-14 10:17  红绿灯演示\TrafficLight\bin\TrafficLight\MyTrafficLight$1.class

     文件       3167  2009-07-13 23:08  红绿灯演示\TrafficLight\image\west\1.gif

     文件       3231  2009-07-13 23:08  红绿灯演示\TrafficLight\image\west\2.gif

     文件       3261  2009-07-13 23:08  红绿灯演示\TrafficLight\image\west\3.gif

     文件       3104  2009-07-13 23:06  红绿灯演示\TrafficLight\image\east\1.gif

     文件       3231  2009-07-13 23:06  红绿灯演示\TrafficLight\image\east\2.gif

     文件       3763  2009-07-13 23:07  红绿灯演示\TrafficLight\image\east\3.gif

     文件       3029  2009-07-13 23:08  红绿灯演示\TrafficLight\image\north\1.gif

     文件       3068  2009-07-13 23:08  红绿灯演示\TrafficLight\image\north\2.gif

     文件       2928  2009-07-13 23:09  红绿灯演示\TrafficLight\image\north\3.gif

     文件       3041  2009-07-13 23:09  红绿灯演示\TrafficLight\image\south\1.gif

     文件       3068  2009-07-13 23:09  红绿灯演示\TrafficLight\image\south\2.gif

     文件       2899  2009-07-13 23:10  红绿灯演示\TrafficLight\image\south\3.gif

     文件       2886  2009-07-07 23:45  红绿灯演示\TrafficLight\img\ico.gif

     文件      10784  2009-07-13 23:02  红绿灯演示\TrafficLight\img\1.gif

     文件       3167  2009-07-13 23:08  红绿灯演示\image\west\1.gif

     文件       3231  2009-07-13 23:08  红绿灯演示\image\west\2.gif

     文件       3261  2009-07-13 23:08  红绿灯演示\image\west\3.gif

     文件       3104  2009-07-13 23:06  红绿灯演示\image\east\1.gif

     文件       3231  2009-07-13 23:06  红绿灯演示\image\east\2.gif

............此处省略27个文件信息

评论

共有 条评论