diff --git a/src/windowInterface/MyInterface.java b/src/windowInterface/MyInterface.java index aea9dba..6e469fe 100644 --- a/src/windowInterface/MyInterface.java +++ b/src/windowInterface/MyInterface.java @@ -12,7 +12,6 @@ import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import backend.Simulator; -import backend.World; import javax.swing.JButton; import javax.swing.JFileChooser; @@ -36,13 +35,9 @@ public class MyInterface extends JFrame { private JLabel speedLabel; private JPanelDraw panelDraw; private Simulator mySimu=null; - private World myWorld; private JSlider randSlider; private JSlider speedSlider; private JLabel clickLabel; - public JSlider getRandSlider() { - return randSlider; - } /** * Create the frame. @@ -180,9 +175,8 @@ public class MyInterface extends JFrame { randSlider.setMaximum(100); randSlider.setPreferredSize(new Dimension(30,200)); panelRight.add(randSlider); - - - + + JButton btnBorder = new JButton("Toggle Border"); btnBorder.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { @@ -204,8 +198,6 @@ public class MyInterface extends JFrame { clickLabel = new JLabel("click : X"); panelRight.add(clickLabel); clickLabel.setText("click : " + mySimu.clickActionName()); - - myWorld = new World(100,100); } @@ -229,12 +221,10 @@ public class MyInterface extends JFrame { public void instantiateSimu() { if(mySimu==null) { - mySimu = new Simulator(this, 100, 100); + mySimu = new Simulator(this); panelDraw.setSimu(mySimu); } } - - public void clicButtonGo() { this.instantiateSimu(); @@ -275,16 +265,9 @@ public class MyInterface extends JFrame { public void generateRandomBoard() { this.instantiateSimu(); float chanceOfLife = ((float)randSlider.getValue())/((float)randSlider.getMaximum()); - JPanelDraw panelDraw = getPanelDessin(); - mySimu.generateRandomWorld(chanceOfLife, panelDraw); + mySimu.generateRandom(chanceOfLife); panelDraw.repaint(); } - public void actionPerformed(ActionEvent arg0) { - float chanceOfLife = ((float) randSlider.getValue()) / ((float)randSlider.getMaximum()); - mySimu.generateRandomWorld(chanceOfLife, panelDraw); - } - - public void changeSpeed() { if(mySimu != null) { @@ -296,7 +279,7 @@ public class MyInterface extends JFrame { } public void clicLoadFileButton() { - Simulator loadedSim = new Simulator(this, 100, 100); + Simulator loadedSim = new Simulator(this); String fileName=SelectFile(); ArrayList stringArray = new ArrayList(); if (fileName.length()>0) { @@ -324,9 +307,10 @@ public class MyInterface extends JFrame { + //trying to make the baseworld //to integrate the baseworld public void clicLoadFileButtonCSV(String fileName) { - Simulator loadedSim = new Simulator(this, 100, 100); + Simulator loadedSim = new Simulator(this); //String fileName="baseworld.csv"; ArrayList stringArray = new ArrayList(); if (fileName.length()>0) { @@ -371,7 +355,7 @@ public class MyInterface extends JFrame { } catch (Exception e) { e.printStackTrace(); } - mySimu.rules.loadRule(stringArray); + mySimu.loadRule(stringArray); this.repaint(); } } @@ -470,11 +454,5 @@ public class MyInterface extends JFrame { - - - - - - -} +} \ No newline at end of file