资源简介
java做的城铁和地铁模拟系统,可直接运行!画面漂亮!容易理解!是学习java的好资料!
代码片段和文件信息
import java.awt.*;
import java.applet.*;
public class Chengtie extends applet implements Runnable
{
Thread t=null;
//音乐
AudioClip audioRing;
AudioClip audioLine;
AudioClip audioStop;
AudioClip audio13;
public final static int numOfTrain=28;
public final static int numOfRingTrain=8;
public final static int numOfOneTrain=10;
public final static int numOf13Train=10;
public final static int numOfStation=55;
static Train trains[]=new Train[numOfTrain];
static Station stations[]=new Station[numOfStation];
//定义城铁方向常量
public final static int EAST=0;
public final static int NORTH=270;
public final static int WEST=180;
public final static int SOUTH=90;
public final static int SOUTHEAST=60;
public final static int NORTHWEST=240;
public final static int NORTHWESTL=243;
public final static int SOUTHEASTL=63;
public final static int SOUTHEASTR=16;
public final static int NORTHWESTR=196;
//定义地图位置常量
public final static int LINE_LEFT=2;
public final static int LINE_RIGHT=630;
public final static int LINE_TOP=536;
public final static int RING_LEFT=290;
public final static int RING_RIGHT=500;
public final static int RING_TOP=410;
public final static int RING_BOTTOM=582;
public final static int T_TOP=123;
public final static int T_LEFT=149;
public final static int T_MIDDLEX=330;
public final static int T_MIDDLEY=167;
public final static int T_RIGHT=490;
public final static int T_BOTTOM=395;
public final static int T_STARX=285;
public final static int T_ENDX=490;
//采用双缓冲技术后台绘制图像
Image offScreenImage;
Image backGroundImage;
Image stopImagestopInImageplayImageplayInImage;
Graphics offScreenGraphics;
MediaTracker mediatracker;
int imgButtonLeft=330;
int imgButtonHeight=200;
Label label1label2;
Choice choiceWhichTrain;
TextField textWhichSpeed;
TextField textStatus;
Button buttonchangeSpeed;
public int traintoBeTraced=0; //被跟踪运行状况的列车号
public boolean trainPaused=false; //列车是否处于暂停状态
boolean moveDisplay=false; //是否显示运行状态
int sleeptime=150;
public void init()
{
t=new Thread(this);
//设置各列车的初始方向及位置
for(int i=0;i<4;i++) //0-3 西直门站
trains[i]=new Train(RING_LEFT431NORTHColor.redi-55*i“环线“);
setVisible(false);
for(int i=4;i<8;i++) //4-7 西直门站
trains[i]=new Train(RING_LEFT431SOUTHColor.redi-55*(i-4)“环线“);
setVisible(false);
for(int i=0;i<5;i++) //8-12 苹果园站
trains[i+8]=new Train(LINE_LEFT510SOUTHEASTColor.green
i+numOfRingTrain-40*i“一线“);
for(int i=5;i<10;i++) //13-17 四惠东站
trains[i+8]=new Train(LINE_RIGHTLINE_TOPWESTColor.green
i+numOfRingTrain-40*(i-5)“一线“);
for(int i=0;i<5;i++) //18-22 北京北站
trains[i+18]=new Train(T_STARXT_BOTTOMNORTHWE
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
......R 23885 2003-06-30 13:26 14 城铁和地铁运行调度\Chengtie.java
......R 595 2003-06-30 13:16 14 城铁和地铁运行调度\Chengtie.jcp
......R 269 2003-05-20 16:37 14 城铁和地铁运行调度\Chengtie.jcw
......R 48072 2001-05-06 12:19 14 城铁和地铁运行调度\classes\AUDIO13.AU
......R 10688 2003-06-30 13:26 14 城铁和地铁运行调度\classes\Chengtie.class
......R 193 2003-08-10 18:12 14 城铁和地铁运行调度\classes\Chengtie.htm
......R 60135 2003-06-23 19:25 14 城铁和地铁运行调度\classes\Chengtie.jpg
......R 5075 1999-05-15 21:19 14 城铁和地铁运行调度\classes\DING.AU
......R 1564413 2001-05-18 19:47 14 城铁和地铁运行调度\classes\LIONKING.AU
......R 1131402 1999-05-15 21:27 14 城铁和地铁运行调度\classes\RANDJ.AU
......R 2511 2003-06-30 13:26 14 城铁和地铁运行调度\classes\Station.class
......R 2722 2003-06-30 13:26 14 城铁和地铁运行调度\classes\Train.class
......R 380 1999-05-24 20:02 14 城铁和地铁运行调度\classes\play.GIF
......R 1141 2001-04-23 14:20 14 城铁和地铁运行调度\classes\play.in.gif
......R 399 1999-05-24 20:03 14 城铁和地铁运行调度\classes\stop.GIF
......R 381 1999-05-24 20:03 14 城铁和地铁运行调度\classes\stop.in.gif
......R 367 2003-06-30 13:45 14 城铁和地铁运行调度\readme.txt
......R 41 2003-06-30 13:17 14 城铁和地铁运行调度\src_chengtie.txt
......R 204421 2003-06-30 13:34 14 城铁和地铁运行调度\截图1.jpg
......R 174840 2003-06-30 13:36 14 城铁和地铁运行调度\截图2.jpg
...D..R 0 2004-12-20 14:38 14 城铁和地铁运行调度\classes
...D..R 0 2004-12-20 14:38 14 城铁和地铁运行调度
----------- --------- ---------- ----- ----
3231930 22
- 上一篇:JAVA课程设计魔板游戏
- 下一篇:社区人口智能管理系统
评论
共有 条评论