我的当前动画有问题,我正在使用Java Swing运行.这是一个离散事件模拟,基于文本的模拟工作正常,我只是在连接模拟到GUI输出时遇到问题.
在这个例子中,我将有10辆车要模拟.JPanels我将在几分钟内详细说明这些汽车.
所以考虑一下,事件process_car_arrival.每次计划执行此事件时,我都会在我的类中Car向被ArrayList调用者添加一个对象.本类具有以下相关属性:carsModelCar
Point currentPos; // The current position, initialized in another method when knowing route.
double speed; // giving the speed any value still causes the same problem but I have 5 atm.
RouteType route; // for this example I only consider one simple route
Run Code Online (Sandbox Code Playgroud)
另外它有以下方法move():
switch (this.route) {
case EAST:
this.currentPos.x -= speed;
return this.currentPos;
.
.
.
//only above is relevant in this example
Run Code Online (Sandbox Code Playgroud)
这一切都很好.所以从理论上讲,汽车沿着一条直线道路从东向西穿过,因为我只是 …