我已经构建了一个Simulation,需要在其上添加一个GUI来选择x数量的模拟步骤。该程序现在仅向我显示最终结果,我需要它来显示仿真。
我可以在命令窗口中看到它的运行状态,但不会显示字符的移动。
模拟是一个房间的2D网格,人们根据他们的下一个对象以及他们的幸福程度来回走动。如果没有GUI,该程序就可以正常工作,因此我假设是否将非GUI代码中的主参数中的代码放到为我的模拟按钮执行的操作中就可以了。
现在这是actionPerformed方法:
private void simButtonActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
Simulator simulator = new Simulator(50, 50, 43);
// simulate the project for 10 rounds
simulator.simulate(10);
// simulator.setVisible(true);
}