Skip to content
Snippets Groups Projects
Commit 87b4c71e authored by Eilert Tunheim's avatar Eilert Tunheim
Browse files

Merge branch 'Eilerts_branch' into 'master'

Added input-popup window, started filling in textfields, labels and buttons

See merge request mesji/bacheloroppgave_2022!34
parents bcd8cdb1 8a4deb32
No related branches found
No related tags found
No related merge requests found
...@@ -14,38 +14,61 @@ public class Input { ...@@ -14,38 +14,61 @@ public class Input {
public static void display() public static void display()
{ {
Stage popupwindow=new Stage(); Stage window = new Stage();
popupwindow.initModality(Modality.APPLICATION_MODAL);
popupwindow.setTitle("Input Parameters");
window.initModality(Modality.APPLICATION_MODAL);
window.setTitle("Input Parameters");
// Top
Label inputLabel= new Label("Input"); Label inputLabel= new Label("Input");
inputLabel.setAlignment(Pos.TOP_CENTER); inputLabel.setId("inputTop");
// Center - Input fields
Button close= new Button("Close this pop up window"); Label treeSpeciesInputLabel = new Label("Tree Species");
close.setAlignment(Pos.BOTTOM_CENTER); treeSpeciesInputLabel.setId("inputLabel");
TextField treeSpeciesInputText = new TextField();
close.setOnAction(e -> popupwindow.close()); treeSpeciesInputText.setId("inputLabelText");
treeSpeciesInputText.setPromptText("Bjørk");
treeSpeciesInputText.getText();
BorderPane layout= new BorderPane(); Label dimensionsInputLabel = new Label("Width x Height");
//layout.set(inputLabel); dimensionsInputLabel.setId("inputLabel");
//layout.setCenter(); TextField dimensionsInputText = new TextField();
//layout.setBottom(close); dimensionsInputText.setId("inputLabelText");
dimensionsInputText.setPromptText("47 x 150");
Label sawsetInputLabel = new Label("Sawset");
layout.getChildren().addAll(inputLabel, close); sawsetInputLabel.setId("inputLabel");
TextField sawsetInputText = new TextField();
sawsetInputText.setId("inputLabelText");
Scene scene1= new Scene(layout, 300, 250); sawsetInputText.setPromptText("4x");
popupwindow.setScene(scene1); Label moistureGoalInputLabel = new Label("Moisture Goal");
moistureGoalInputLabel.setId("inputLabel");
popupwindow.showAndWait(); TextField moistureGoalInputText = new TextField();
moistureGoalInputText.setId("inputLabelText");
moistureGoalInputText.setPromptText("12%");
// Bottom - start button
Button startButton = new Button("Start");
startButton.setId("inputButtonStart");
startButton.setOnAction(e -> {
window.close();
});
VBox layout = new VBox(10);
layout.getChildren().addAll(inputLabel, treeSpeciesInputLabel, treeSpeciesInputText, dimensionsInputLabel, dimensionsInputText,
sawsetInputLabel, sawsetInputText, moistureGoalInputLabel, moistureGoalInputText, startButton);
layout.setAlignment(Pos.CENTER);
Scene scene = new Scene(layout, 600, 600);
scene.getStylesheets().add(Input.class.getResource("/com.application/CSS/styleSheet.css").toExternalForm());
window.setScene(scene);
window.showAndWait();
} }
......
...@@ -101,11 +101,7 @@ public class Main extends Application { ...@@ -101,11 +101,7 @@ public class Main extends Application {
VBox.setVgrow(this.logoBar, Priority.ALWAYS); VBox.setVgrow(this.logoBar, Priority.ALWAYS);
//DB.getName();
//System.out.println(DB.getKwh());
// Sets the scene and defines boundaries // Sets the scene and defines boundaries
//Scene scene = new Scene(root, 1200, 600);
Scene scene = new Scene(root, 1200, 600); Scene scene = new Scene(root, 1200, 600);
scene.getStylesheets().add(getClass().getResource("/com.application/CSS/styleSheet.css").toExternalForm()); scene.getStylesheets().add(getClass().getResource("/com.application/CSS/styleSheet.css").toExternalForm());
...@@ -149,7 +145,6 @@ public class Main extends Application { ...@@ -149,7 +145,6 @@ public class Main extends Application {
// Creating a vbox // Creating a vbox
VBox sideBarVBox = new VBox(); VBox sideBarVBox = new VBox();
//sideBarVBox.prefHeight(500);
Label treeSpeciesLabel = new Label("Tree Species"); Label treeSpeciesLabel = new Label("Tree Species");
treeSpeciesLabel.setId("sideBarLabelText"); treeSpeciesLabel.setId("sideBarLabelText");
......
/* General css for alle the main windows */ /*
Css for main window styling
*/
/*noinspection CssUnusedSymbol*/
.root { .root {
-fx-pref-width: 1150; -fx-pref-width: 1150;
-fx-pref-height: 600; -fx-pref-height: 600;
...@@ -48,6 +49,53 @@ ...@@ -48,6 +49,53 @@
-fx-background-color: rgba(104, 229, 59, 1); -fx-background-color: rgba(104, 229, 59, 1);
} }
/*
Input popup window
*/
#inputTop {
-fx-alignment: top-center;
-fx-font-size: 24;
-fx-font-family: Arial;
-fx-background-color: rgba(12, 76, 81, 1);
-fx-text-fill: white;
-fx-pref-width: 200;
}
#inputCenter {
-fx-alignment: center;
}
#inputBottom {
-fx-alignment: bottom-center;
}
#inputLabel {
-fx-pref-height: 17;
-fx-translate-x: 10;
-fx-pref-width: 100;
-fx-max-height: infinity;
-fx-max-width: infinity;
-fx-font-size: 16;
-fx-font-family: Arial;
}
#inputLabelText {
-fx-pref-height: 17;
-fx-translate-x: 5;
-fx-max-height: infinity;
-fx-max-width: infinity;
-fx-font-size: 16;
-fx-font-family: Arial;
}
#inputButtonStart {
-fx-pref-width: infinity;
-fx-pref-height: 25;
-fx-font-size: 20;
-fx-font-family: Arial;
-fx-background-color: rgba(12, 76, 81, 1);
-fx-text-fill: white;
}
/* General css for alle the main windows */ /*
Css for main window styling
*/
/*noinspection CssUnusedSymbol*/
.root { .root {
-fx-pref-width: 1150; -fx-pref-width: 1150;
-fx-pref-height: 600; -fx-pref-height: 600;
...@@ -48,6 +49,53 @@ ...@@ -48,6 +49,53 @@
-fx-background-color: rgba(104, 229, 59, 1); -fx-background-color: rgba(104, 229, 59, 1);
} }
/*
Input popup window
*/
#inputTop {
-fx-alignment: top-center;
-fx-font-size: 24;
-fx-font-family: Arial;
-fx-background-color: rgba(12, 76, 81, 1);
-fx-text-fill: white;
-fx-pref-width: 200;
}
#inputCenter {
-fx-alignment: center;
}
#inputBottom {
-fx-alignment: bottom-center;
}
#inputLabel {
-fx-pref-height: 17;
-fx-translate-x: 10;
-fx-pref-width: 100;
-fx-max-height: infinity;
-fx-max-width: infinity;
-fx-font-size: 16;
-fx-font-family: Arial;
}
#inputLabelText {
-fx-pref-height: 17;
-fx-translate-x: 5;
-fx-max-height: infinity;
-fx-max-width: infinity;
-fx-font-size: 16;
-fx-font-family: Arial;
}
#inputButtonStart {
-fx-pref-width: infinity;
-fx-pref-height: 25;
-fx-font-size: 20;
-fx-font-family: Arial;
-fx-background-color: rgba(12, 76, 81, 1);
-fx-text-fill: white;
}
File added
No preview for this file type
No preview for this file type
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