Skip to content

Commit

Permalink
removed extra parameter sliders (will be implemented later, next spri…
Browse files Browse the repository at this point in the history
…nt), updated play button to include pause
  • Loading branch information
KelBell1009 committed Sep 25, 2017
1 parent 527af1f commit a2001fc
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
Binary file added images/play.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/cellsociety_UIUX/SegregationWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ public class SegregationWindow extends SimulationWindow {

public SegregationWindow(Stage s) {
super(s);
addSlider(minSimilar);
/* addSlider(minSimilar);
addSlider(redToBlue);
addSlider(emptyRatio);
addSlider(emptyRatio);*/
}


Expand Down
23 changes: 17 additions & 6 deletions src/cellsociety_UIUX/SimulationWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ public abstract class SimulationWindow extends Window {
//protected boolean started = false;
protected boolean running = false;
protected boolean stepping = false;
protected Button startButton = new Button();
protected Button playButton = new Button();
protected Button stepButton = new Button();
protected ImageView playImageView, pauseImageView;

protected int numCells;
protected int cellSize = 50;
Expand Down Expand Up @@ -62,9 +63,15 @@ public SimulationWindow(Stage s) {

public void userInteraction() {
// TODO Auto-generated method stub
startButton.setOnAction(new EventHandler<ActionEvent>() {
playButton.setOnAction(new EventHandler<ActionEvent>() {
@Override public void handle(ActionEvent e) {
running = !running;
if (running) {
playButton.setGraphic(pauseImageView);
}
else {
playButton.setGraphic(playImageView);
}
}
});

Expand Down Expand Up @@ -134,13 +141,17 @@ public void setRowSize(CellManager c) {

private void addButtons() {
//TODO
Image startImage = new Image(getClass().getClassLoader().getResourceAsStream("start.png"));
startButton.setGraphic(new ImageView(startImage));
Image playImage = new Image(getClass().getClassLoader().getResourceAsStream("play.png"));
playImageView = new ImageView(playImage);
playButton.setGraphic(playImageView);

Image stepImage = new Image(getClass().getClassLoader().getResourceAsStream("step.png"));
stepButton.setGraphic(new ImageView(stepImage));

buttons = new ArrayList<Button>(Arrays.asList(startButton, stepButton));

Image pauseImage = new Image(getClass().getClassLoader().getResourceAsStream("pause.png"));
pauseImageView = new ImageView(pauseImage);

buttons = new ArrayList<Button>(Arrays.asList(playButton, stepButton));

for (int i = 0; i < buttons.size(); i++) {
Button button = buttons.get(i);
Expand Down

0 comments on commit a2001fc

Please sign in to comment.