From 4f29c74958c3de193d8959ea7f9f84569063c388 Mon Sep 17 00:00:00 2001 From: laure Date: Mon, 27 May 2024 13:12:08 +0200 Subject: [PATCH] creation of the button stop (but doesn't do the action) --- src/backend/Simulator.java | 3 +-- src/windowInterface/MyInterface.java | 12 ++++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/backend/Simulator.java b/src/backend/Simulator.java index b088df2..650e522 100644 --- a/src/backend/Simulator.java +++ b/src/backend/Simulator.java @@ -259,7 +259,7 @@ public class Simulator extends Thread { } return saveState; - //TODO : complete method with proper return + } /** * @@ -302,7 +302,6 @@ public class Simulator extends Thread { * to be alive in new state */ public void generateRandom(float chanceOfLife) { - //TODO : complete method /* * Advice : * as you should probably have a separate class diff --git a/src/windowInterface/MyInterface.java b/src/windowInterface/MyInterface.java index 3f6ec1a..d0a433f 100644 --- a/src/windowInterface/MyInterface.java +++ b/src/windowInterface/MyInterface.java @@ -64,6 +64,14 @@ public class MyInterface extends JFrame { } }); panelTop.add(btnGo); + + JButton btnStop = new JButton("Stop"); + btnStop.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + clicButtonStop(); + } + }); + panelTop.add(btnStop); JButton btnClickAct = new JButton("Toggle Click"); btnClickAct.addActionListener(new ActionListener() { @@ -223,6 +231,10 @@ public class MyInterface extends JFrame { mySimu.togglePause(); } } + + public void clicButtonStop() { + //TODO + } public void clicButtonToggleClickAction() { if(mySimu != null) {