资源简介

模拟交通十字路口 红绿灯和车辆状况 有简单UI

资源截图

代码片段和文件信息

package test;
import java.util.Timer;
import java.util.TimerTask;

/**
* Simple demo that uses java.util.Timer to schedule a task to execute
* once 5 seconds have passed.
*/

public class Reminder {
    Timer timer;

    public Reminder(int seconds) {
        timer = new Timer();
        timer.schedule(new RemindTask() seconds*1000);
    }

    public class RemindTask extends TimerTask {
        public void run() {
            System.out.println(“Time‘s up!“);
            timer.cancel(); //Terminate the timer thread
        }
    }

    public static void main(String args[]) {
        System.out.println(“About to schedule task.“);
        new Reminder(5);
        System.out.println(“Task scheduled.“);
    }
}

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

     文件        301  2013-11-07 20:38  TrafficDemo\.classpath

     文件        387  2013-11-07 20:38  TrafficDemo\.project

     文件        629  2013-11-07 20:38  TrafficDemo\.settings\org.eclipse.jdt.core.prefs

     文件        732  2013-11-12 22:21  TrafficDemo\bin\test\Reminder$RemindTask.class

     文件        904  2013-11-12 22:21  TrafficDemo\bin\test\Reminder.class

     文件        823  2013-11-12 22:21  TrafficDemo\bin\test\TimerDemo$1.class

     文件       1631  2013-11-12 22:21  TrafficDemo\bin\test\TimerDemo.class

     文件       4643  2013-11-15 23:06  TrafficDemo\bin\traffic\Car.class

     文件       4480  2013-11-15 23:06  TrafficDemo\bin\traffic\Control.class

     文件       1310  2013-11-15 23:06  TrafficDemo\bin\traffic\Direction.class

     文件       3071  2013-11-17 10:26  TrafficDemo\bin\traffic\DrawTraffic.class

     文件        869  2013-11-15 23:06  TrafficDemo\bin\traffic\Light.class

     文件       2889  2013-11-15 23:06  TrafficDemo\bin\traffic\Position.class

     文件       1941  2013-11-17 10:20  TrafficDemo\bin\traffic\TrafficSystem$MyTask.class

     文件        615  2013-11-17 10:20  TrafficDemo\bin\traffic\TrafficSystem$MyTask2.class

     文件        616  2013-11-17 10:20  TrafficDemo\bin\traffic\TrafficSystem$MyTask3.class

     文件       3477  2013-11-17 10:20  TrafficDemo\bin\traffic\TrafficSystem.class

     文件        748  2013-11-07 21:47  TrafficDemo\src\test\Reminder.java

     文件       1036  2013-11-07 20:49  TrafficDemo\src\test\TimerDemo.java

     文件       4746  2013-11-15 23:06  TrafficDemo\src\traffic\Car.java

     文件       3144  2013-11-15 23:06  TrafficDemo\src\traffic\Control.java

     文件        319  2013-11-15 23:06  TrafficDemo\src\traffic\Direction.java

     文件       3559  2013-11-17 10:26  TrafficDemo\src\traffic\DrawTraffic.java

     文件       1327  2013-11-15 23:06  TrafficDemo\src\traffic\Light.java

     文件       1866  2013-11-15 23:06  TrafficDemo\src\traffic\Position.java

     文件       3202  2013-11-17 10:20  TrafficDemo\src\traffic\TrafficSystem.java

     目录          0  2013-11-12 22:21  TrafficDemo\bin\test

     目录          0  2013-11-17 10:18  TrafficDemo\bin\traffic

     目录          0  2013-11-07 20:49  TrafficDemo\src\test

     目录          0  2013-11-17 10:18  TrafficDemo\src\traffic

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

评论

共有 条评论