Skip to content
Snippets Groups Projects
Commit 1806ffcb authored by Håvard Daleng's avatar Håvard Daleng
Browse files

Made working solution for description combo box. Still need to add different...

Made working solution for description combo box. Still need to add different descriptions and potentially replace the radio button system entirely.
parent eedfae42
No related branches found
No related tags found
No related merge requests found
......@@ -175,7 +175,7 @@ public class GuiButtonController {
/**
* Clear the image view.
*/
public void clearImageView() {
public void clearCanvas() {
chaosCanvas.clearCanvas();
GraphicsContext gc = gui.getCanvas().getGraphicsContext2D();
gc.clearRect(0, 0, gui.getCanvas().getWidth(), gui.getCanvas().getHeight());
......@@ -197,7 +197,7 @@ public class GuiButtonController {
gui.getStartButton().setOnAction(event -> startGame());
gui.getStopButton().setOnAction(event -> stopGame());
gui.getClearButton().setOnAction(event -> clearImageView());
gui.getClearButton().setOnAction(event -> clearCanvas());
gui.getQuitButton().setOnAction(event -> quitGame());
gui.getColorCheckBox().setOnAction(event -> game.setUseColor(gui.getColorCheckBox().isSelected()));
......@@ -219,7 +219,7 @@ public class GuiButtonController {
chaosCanvas.clearCanvas();
gui.getCanvas().getGraphicsContext2D().clearRect(0, 0, gui.getCanvas().getGraphicsContext2D().
getCanvas().getWidth(), gui.getCanvas().getGraphicsContext2D().getCanvas().getHeight());
clearImageView();
clearCanvas();
chaosCanvas.clearCanvas();
// Get the new description and create a new ChaosCanvas
......
......@@ -339,6 +339,7 @@ public class ChaosGameGui implements ChaosGameObserver {
descriptionComboBox.getSelectionModel().selectedItemProperty()
.addListener((observable, oldValue, newValue) -> {
for (int i = 0; i < factory.getDescriptions().size(); i++) {
ChaosGameDescription description = factory.getDescriptions().get(i);
if (description.getName().equals(newValue)) {
controller.updateDescription(i);
break;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment