reset/stop works !!!!
This commit is contained in:
parent
ac78093dfc
commit
730c3cce78
|
|
@ -178,7 +178,7 @@ public class Simulator extends Thread {
|
||||||
*/
|
*/
|
||||||
public void stopSimu() {
|
public void stopSimu() {
|
||||||
stopFlag=true;
|
stopFlag=true;
|
||||||
this.interrupt();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startSimu() { // same as stopSimu but will set the stopFlag value as false.
|
public void startSimu() { // same as stopSimu but will set the stopFlag value as false.
|
||||||
|
|
@ -450,7 +450,8 @@ public class Simulator extends Thread {
|
||||||
public void startSimulation() {
|
public void startSimulation() {
|
||||||
if (isWorldEmpty()) {
|
if (isWorldEmpty()) {
|
||||||
mjf.clicLoadFileButtonCSV("World/baseworld.csv");
|
mjf.clicLoadFileButtonCSV("World/baseworld.csv");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ public class MyInterface extends JFrame {
|
||||||
});
|
});
|
||||||
panelTop.add(btnGo);
|
panelTop.add(btnGo);
|
||||||
|
|
||||||
JButton btnStop = new JButton("Stop");
|
JButton btnStop = new JButton("Reset");
|
||||||
btnStop.addActionListener(new ActionListener() {
|
btnStop.addActionListener(new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent arg0) {
|
public void actionPerformed(ActionEvent arg0) {
|
||||||
clicButtonStop();
|
clicButtonStop();
|
||||||
|
|
@ -199,6 +199,9 @@ public class MyInterface extends JFrame {
|
||||||
panelRight.add(clickLabel);
|
panelRight.add(clickLabel);
|
||||||
clickLabel.setText("click : " + mySimu.clickActionName());
|
clickLabel.setText("click : " + mySimu.clickActionName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void setStepBanner(String s) {
|
public void setStepBanner(String s) {
|
||||||
stepLabel.setText(s);
|
stepLabel.setText(s);
|
||||||
|
|
@ -237,19 +240,11 @@ public class MyInterface extends JFrame {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clicButtonStop() {
|
public void clicButtonStop() {
|
||||||
//mySimu.stopSimu();
|
|
||||||
//update(0);
|
|
||||||
//instantiateSimu();
|
|
||||||
|
|
||||||
mySimu.stopSimu(); // Stop the simulation
|
mySimu.stopSimu(); // Stop the simulation
|
||||||
mySimu.reset(); // Reset the simulation state
|
mySimu.reset(); // Reset the simulation state
|
||||||
//panelDraw.repaint(); // Refresh the display
|
panelDraw.repaint(); // Refresh the display
|
||||||
eraseLabels(); // Reset the labels to their initial state
|
eraseLabels(); // Reset the labels to their initial state
|
||||||
//mySimu.stopSimu();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clicButtonToggleClickAction() {
|
public void clicButtonToggleClickAction() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue