Browse Source

Adds Restart text to simulation start/stop button if sim is over

Andreas T. Meyer-Berg 5 years ago
parent
commit
a6674411d6

+ 4 - 2
src/main/java/de/tu_darmstadt/tk/SmartHomeNetworkSim/view/popups/SimulationConfigurator.java

@@ -286,8 +286,10 @@ public class SimulationConfigurator extends JFrame implements Observer{
 		//Change Button Text
 		if (sim.isRunning()) {
 			btnStartStop.setText("Stop Simulation");
-		} else {
+		} else if(sim.getCurrentTime()<sim.getEndTime()){
 			btnStartStop.setText("Start Simulation");
+		} else{
+			btnStartStop.setText("Restart Simulation");
 		}
 		mutex = false;
 		
@@ -407,7 +409,7 @@ public class SimulationConfigurator extends JFrame implements Observer{
 			if(sim.isRunning()){
 				sim.stopSimulation();
 			}else{
-				if(sim.getCurrentTime()==sim.getEndTime()){
+				if(sim.getCurrentTime()>=sim.getEndTime()){
 					//Reset
 					sim.resetSimulation();
 				}