Pārlūkot izejas kodu

fixes a TimePanel Bug when currentIteration was bigger than maxIteration

It occured when the number of iterations was set during simulation mode
to a value smaller than than the current Iteration.
The currentIteration will now be set to the number of iterations and the
simulation will be stoppped.
Andreas T. Meyer-Berg 6 gadi atpakaļ
vecāks
revīzija
2946575104
1 mainītis faili ar 1 papildinājumiem un 1 dzēšanām
  1. 1 1
      src/ui/view/TimePanel.java

+ 1 - 1
src/ui/view/TimePanel.java

@@ -94,7 +94,7 @@ public class TimePanel extends JPanel implements ActionListener{
 				timeSlider.setValue(timeSlider.getValue() + 1);
 				controller.setCurIteration(timeSlider.getValue());
 				timer.setDelay(model.getTimerSpeed());
-				if (timeSlider.getValue() == model.getIterations() - 1) {
+				if (timeSlider.getValue() >= model.getIterations() - 1) {
 					running = false;
 					playBtn.setIcon(new ImageIcon(Util.loadImage(this, "/Button_Images/play.png", 30, 30, Image.SCALE_SMOOTH)));
 					timer.stop();