reset/stop works !!!!

This commit is contained in:
Laure BEL 2024-05-28 09:57:53 +02:00
parent ac78093dfc
commit 730c3cce78
2 changed files with 10 additions and 14 deletions

View File

@ -178,7 +178,7 @@ public class Simulator extends Thread {
*/
public void stopSimu() {
stopFlag=true;
this.interrupt();
}
public void startSimu() { // same as stopSimu but will set the stopFlag value as false.
@ -452,6 +452,7 @@ public class Simulator extends Thread {
mjf.clicLoadFileButtonCSV("World/baseworld.csv");
}
}

View File

@ -65,7 +65,7 @@ public class MyInterface extends JFrame {
});
panelTop.add(btnGo);
JButton btnStop = new JButton("Stop");
JButton btnStop = new JButton("Reset");
btnStop.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
clicButtonStop();
@ -200,6 +200,9 @@ public class MyInterface extends JFrame {
clickLabel.setText("click : " + mySimu.clickActionName());
}
public void setStepBanner(String s) {
stepLabel.setText(s);
}
@ -237,19 +240,11 @@ public class MyInterface extends JFrame {
}
public void clicButtonStop() {
//mySimu.stopSimu();
//update(0);
//instantiateSimu();
mySimu.stopSimu(); // Stop the simulation
mySimu.reset(); // Reset the simulation state
//panelDraw.repaint(); // Refresh the display
panelDraw.repaint(); // Refresh the display
eraseLabels(); // Reset the labels to their initial state
//mySimu.stopSimu();
}
public void clicButtonToggleClickAction() {