old my interface
This commit is contained in:
parent
94eb62a29a
commit
7fcb3b27be
|
|
@ -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<String> stringArray = new ArrayList<String>();
|
||||
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<String> stringArray = new ArrayList<String>();
|
||||
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 {
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue