Merge branch 'dev_squ'
This commit is contained in:
commit
fc8e8a44d8
|
|
@ -26,6 +26,7 @@ public class Simulator extends Thread {
|
|||
private int loopDelay = 150;
|
||||
|
||||
//TODO : add missing attribute(s)
|
||||
private double randomDansitySlider = 0.5;
|
||||
private int width;
|
||||
private int height;
|
||||
private boolean enableLogs;
|
||||
|
|
@ -316,6 +317,13 @@ public class Simulator extends Thread {
|
|||
System.out.println("Loop delay set to " + delay);
|
||||
}
|
||||
}
|
||||
|
||||
public void setDansity(double density) {
|
||||
randomDansitySlider = density;
|
||||
if (enableLogs) {
|
||||
System.out.println("Density set to " + density);
|
||||
}
|
||||
}
|
||||
|
||||
public void toggleClickAction() {
|
||||
//TODO-COMPLETE : complete method
|
||||
|
|
|
|||
|
|
@ -165,6 +165,11 @@ public class MyInterface extends JFrame {
|
|||
randSlider.setMinimum(0);
|
||||
randSlider.setMaximum(100);
|
||||
randSlider.setPreferredSize(new Dimension(30,200));
|
||||
randSlider.addChangeListener(new ChangeListener() {
|
||||
public void stateChanged(ChangeEvent arg0) {
|
||||
changeDansity();
|
||||
}
|
||||
});
|
||||
panelRight.add(randSlider);
|
||||
|
||||
|
||||
|
|
@ -254,6 +259,15 @@ public class MyInterface extends JFrame {
|
|||
}
|
||||
}
|
||||
|
||||
public void changeDansity() {
|
||||
if(mySimu != null) {
|
||||
double density = ((double)randSlider.getValue())/((double)randSlider.getMaximum());
|
||||
mySimu.setDansity(density);
|
||||
} else {
|
||||
randSlider.setValue(50);
|
||||
}
|
||||
}
|
||||
|
||||
public void clicLoadFileButton() {
|
||||
Simulator loadedSim = new Simulator(this);
|
||||
String fileName=SelectFile();
|
||||
|
|
|
|||
Loading…
Reference in New Issue