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

Add GUI button tooltip.

parent e700fec8
No related branches found
No related tags found
No related merge requests found
......@@ -68,9 +68,7 @@ public class GuiButtonController {
ChaosGameDescription description = game.getDescription();
// Call the writeToFile method
System.out.println("About to write to file...");
fileHandler.writeToFile(description, file.getPath());
System.out.println("Finished writing to file.");
} catch (IOException e) {
// Handle the exception
e.printStackTrace();
......
......@@ -29,7 +29,9 @@ import javafx.scene.paint.Color;
import javafx.stage.Stage;
import javafx.stage.Window;
import javafx.util.Duration;
import javafx.scene.control.ToolBar;
import javax.tools.Tool;
import java.io.IOException;
public class ChaosGameGui implements ChaosGameObserver {
......@@ -268,10 +270,14 @@ public ChaosGameGui(Stage primaryStage) throws IOException {
controller.updateDescription(3);
});
// Load fractal file button
// Load fractal file button and tooltip
this.loadFractalFromFileButton = new Button("Load Fractal");
// Write fractal to file button
Tooltip loadFractalFromFileButtonTooltip = new Tooltip("Load a text file describing a new fractal chaos game");
Tooltip.install(loadFractalFromFileButton,loadFractalFromFileButtonTooltip);
// Write fractal to file button and tooltip
this.writeFractalToFileButton = new Button("Write to File");
Tooltip writeFractalToFileButtonTooltip = new Tooltip("Write a text file defining the current fractal chaos game to chosen location");
Tooltip.install(writeFractalToFileButton, writeFractalToFileButtonTooltip);
}
/**
......@@ -279,13 +285,28 @@ public ChaosGameGui(Stage primaryStage) throws IOException {
*/
private void initializeSideMenu() {
// Create Buttons
this.startButton = new Button("Start");
this.stopButton = new Button("Stop");
this.newButton = new Button("New");
this.clearButton = new Button("Clear");
this.quitButton = new Button("Quit");
this.sideMenuButton = new Button("Side Menu");
//this.sideMenuButton = new Button("Side Menu");
// Create Tooltips
Tooltip startButtonTooltip = new Tooltip("Starts drawing the current fractal from the selected chaos game");
Tooltip stopButtonTooltip = new Tooltip("Pause drawing current fractal");
Tooltip newButtonTooltip = new Tooltip("Start a new fractal");
Tooltip clearButtonTooltip = new Tooltip("Clear the current fracal");
Tooltip quitButtonTooltip = new Tooltip("Quit the application");
// Attach Tooltips to Buttons
Tooltip.install(startButton,startButtonTooltip);
Tooltip.install(stopButton,stopButtonTooltip);
Tooltip.install(newButton,newButtonTooltip);
Tooltip.install(clearButton,clearButtonTooltip);
Tooltip.install(quitButton, quitButtonTooltip);
this.sideMenu = new VBox();
// Parameters
......@@ -315,6 +336,8 @@ public ChaosGameGui(Stage primaryStage) throws IOException {
HBox minCoordsHBox = new HBox();
minCoordsHBox.getChildren().addAll(minimumCoordinatesTextFieldX,minimumCoordinatesTextFieldY);
Button changeMinimumCoordinatesButton = new Button("Change Min. Coordinates");
Tooltip changeMinimumCoordinatesButtonTooltip = new Tooltip("Change the minimum x and y coordinates for the fractal");
Tooltip.install(changeMinimumCoordinatesButton,changeMinimumCoordinatesButtonTooltip);
minCoordinatesBox.getChildren().addAll(minCoordinatesLabel, minCoordsHBox,
changeMinimumCoordinatesButton);
......@@ -327,12 +350,16 @@ public ChaosGameGui(Stage primaryStage) throws IOException {
HBox maxCoordsHBox = new HBox();
maxCoordsHBox.getChildren().addAll(maximumCoordinatesTextFieldX,maximumCoordinatesTextFieldY);
Button changeMaximumCoordinatesButton = new Button("Change Max Coordinates");
Tooltip changeMaximumCoordinatesButtonTooltip = new Tooltip("Change the maximum x and y coordinates of the fractal");
Tooltip.install(changeMaximumCoordinatesButton,changeMaximumCoordinatesButtonTooltip);
maxCoordinatesBox.getChildren().addAll(maxCoordinatesLabel,
maxCoordsHBox,changeMaximumCoordinatesButton);
HBox colorBox = new HBox();
Label colorLabel = new Label("Use color");
this.colorCheckBox = new CheckBox();
Tooltip colorCheckBoxTooltip = new Tooltip("Change pixel color for pixels drawn multiple times");
Tooltip.install(colorCheckBox,colorCheckBoxTooltip);
Region colorRegion = new Region();
colorRegion.setMinWidth(30);
colorBox.getChildren().addAll(colorCheckBox, colorRegion, colorLabel);
......@@ -379,6 +406,8 @@ public ChaosGameGui(Stage primaryStage) throws IOException {
// Create split pane and button to toggle sidebar
this.sideMenuButton = new Button(">>");
Tooltip sideMenuButtonTooltip = new Tooltip("Hide/Unhide menu");
Tooltip.install(sideMenuButton, sideMenuButtonTooltip);
this.initializeSideButtonHandler();
Region sideMenuButtonRegion = new Region();
sideMenuButtonRegion.setMinWidth(200);
......
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