Skip to content
Snippets Groups Projects
Commit 0a705642 authored by Magnus Eik's avatar Magnus Eik
Browse files

Refactor radioButton functionality to controller class GuiButtonController

parent a9b32376
No related branches found
No related tags found
No related merge requests found
......@@ -37,6 +37,7 @@ public class GuiButtonController {
initializeMainButtons();
this.fileHandler = new ChaosGameFileHandler();
initializeWriteToFileButtonHandler();
initializeRadioButtons();
}
......@@ -125,6 +126,13 @@ public class GuiButtonController {
}
private void initializeRadioButtons(){
gui.getSierpinskiRadioButton().setOnAction(event -> updateDescription(0));
gui.getBarnsleyRadioButton().setOnAction(event -> updateDescription(1));
gui.getJuliaRadioButton().setOnAction(event -> updateDescription(2));
gui.getImprovedBarnsleyButton().setOnAction(event -> updateDescription(3));
}
/**
......
......@@ -269,24 +269,6 @@ public ChaosGameGui(Stage primaryStage) throws IOException {
improvedBarnsleyButton.setToggleGroup(group);
// Set action for Sierpinski radio button.
sierpinskiRadioButton.setOnAction(event -> {
controller.updateDescription(0);
});
// Set action for Barnsley radio button.
barnsleyRadioButton.setOnAction(event -> {
controller.updateDescription(1);
});
// Set action for Julia radio button.
juliaRadioButton.setOnAction(event -> {
controller.updateDescription(2);
});
improvedBarnsleyButton.setOnAction(event -> {
controller.updateDescription(3);
});
// Load fractal file button and tooltip
this.loadFractalFromFileButton = new Button("Load Fractal");
......@@ -590,6 +572,19 @@ public ChaosGameGui(Stage primaryStage) throws IOException {
return this.primaryStage;
}
public RadioButton getSierpinskiRadioButton() {
return this.sierpinskiRadioButton;
}
public RadioButton getBarnsleyRadioButton() {
return this.barnsleyRadioButton;
}
public RadioButton getJuliaRadioButton() {
return this.juliaRadioButton;
}
public RadioButton getImprovedBarnsleyButton(){
return this.improvedBarnsleyButton;
}
private void resizeCanvas() {
double newWidth = scene.getWidth() - sideMenu.getWidth();
double newHeight = scene.getHeight();
......
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