From 668cb3dfdf6822d04f8e2b03820046ced76844fe Mon Sep 17 00:00:00 2001 From: Magnus Eik <“mageik@stud.ntnu.noâ€> Date: Thu, 4 Apr 2024 17:12:34 +0200 Subject: [PATCH] Add dummy buttons and text fields for changeable parameters --- .../stud/chaosgame/view/ChaosGameGUIView.java | 47 +++++++++++++++++-- 1 file changed, 44 insertions(+), 3 deletions(-) diff --git a/src/main/java/edu/ntnu/stud/chaosgame/view/ChaosGameGUIView.java b/src/main/java/edu/ntnu/stud/chaosgame/view/ChaosGameGUIView.java index 361578f..f7eedc0 100644 --- a/src/main/java/edu/ntnu/stud/chaosgame/view/ChaosGameGUIView.java +++ b/src/main/java/edu/ntnu/stud/chaosgame/view/ChaosGameGUIView.java @@ -8,9 +8,9 @@ import edu.ntnu.stud.chaosgame.model.generators.ChaosGameDescriptionFactory; import javafx.animation.KeyFrame; import javafx.animation.Timeline; import javafx.application.Platform; +import javafx.geometry.Insets; import javafx.scene.Scene; -import javafx.scene.control.ToggleGroup; -import javafx.scene.control.RadioButton; +import javafx.scene.control.*; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.image.PixelWriter; @@ -19,7 +19,6 @@ import javafx.scene.layout.BorderPane; import javafx.scene.layout.VBox; import javafx.scene.paint.Color; import javafx.stage.Stage; -import javafx.scene.control.Button; import javafx.util.Duration; import java.io.IOException; @@ -134,6 +133,41 @@ public class ChaosGameGUIView { game = new ChaosGame(description.get(), canvasRef.get()); }); + // Load fractal file button + Button loadFractalFromFileButton = new Button("Load Fractal"); + // Write fractal to file button + Button writeFractalToFileButton = new Button("Write to File"); + + // Parameters + VBox parameterBox = new VBox(); + // Step Count GUI + VBox stepCountBox = new VBox(); + Label stepCountLabel = new Label("Step Count"); + TextArea stepCountTextArea = new TextArea(); + stepCountTextArea.setPrefHeight(5); + stepCountTextArea.setPrefWidth(50); + Button changeStepCountButton = new Button("Change Step Count"); + stepCountBox.getChildren().addAll(stepCountLabel,stepCountTextArea, changeStepCountButton); + // Minimum Coordinates GUI + VBox minCoordinatesBox = new VBox(); + Label minCoordinatesLabel = new Label("Min. Coordinates"); + TextArea minimumCoordinatesTextArea = new TextArea(); + minimumCoordinatesTextArea.setPrefHeight(5); + minimumCoordinatesTextArea.setPrefWidth(50); + Button changeMinimumCoordinatesButton = new Button("Change Min. Coordinates"); + minCoordinatesBox.getChildren().addAll(minCoordinatesLabel,minimumCoordinatesTextArea,changeMinimumCoordinatesButton); + // Maximum Coordinates GUI + VBox maxCoordinatesBox = new VBox(); + Label maxCoordinatesLabel = new Label("Max Coordinates"); + TextArea maximumCoordinatesTextArea = new TextArea(); + maximumCoordinatesTextArea.setPrefHeight(5); + maximumCoordinatesTextArea.setPrefWidth(50); + Button changeMaximumCoordinatesButton = new Button("Change Max Coordinates"); + maxCoordinatesBox.getChildren().addAll(maxCoordinatesLabel,maximumCoordinatesTextArea,changeMaximumCoordinatesButton); + // Fill parameter box + parameterBox.getChildren().addAll(stepCountBox, minCoordinatesBox, maxCoordinatesBox); + parameterBox.setPadding(new Insets(10)); + // Quit button Button quitButton = new Button("Quit"); quitButton.setOnAction(event -> Platform.exit()); @@ -142,8 +176,14 @@ public class ChaosGameGUIView { sideMenu.getChildren().addAll(startButton,stopButton,newButton,clearButton); // Add fractal radio buttons sideMenu.getChildren().addAll(sierpinskiRadioButton, barnsleyRadioButton, juliaRadioButton); + // Add parameter VBox + sideMenu.getChildren().add(parameterBox); + // Add file buttons + sideMenu.getChildren().addAll(loadFractalFromFileButton,writeFractalToFileButton); // Add quit button sideMenu.getChildren().add(quitButton); + // Add padding + sideMenu.setPadding(new Insets(10)); @@ -204,4 +244,5 @@ public class ChaosGameGUIView { public void setImageViewFromImage(Image inputView) { this.imageView.setImage(inputView); } + } -- GitLab