diff --git a/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/Millions.java b/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/Millions.java index 67cb162..26ecef8 100644 --- a/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/Millions.java +++ b/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/Millions.java @@ -1,15 +1,17 @@ package edu.ntnu.idi.idatt2003.gruppe42; +import edu.ntnu.idi.idatt2003.gruppe42.View.StartScreen; import javafx.application.Application; import javafx.scene.Scene; -import javafx.scene.layout.BorderPane; +import javafx.scene.layout.StackPane; import javafx.stage.Stage; public class Millions extends Application { @Override public void start(Stage stage) throws Exception { - BorderPane root = new BorderPane(); + StartScreen startScreen = new StartScreen(); + StackPane root = startScreen.getRoot(); Scene scene = new Scene(root, 900, 700); stage.setTitle("Millions"); diff --git a/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/View/StartScreen.java b/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/View/StartScreen.java new file mode 100644 index 0000000..6ed3cdc --- /dev/null +++ b/src/main/java/edu/ntnu/idi/idatt2003/gruppe42/View/StartScreen.java @@ -0,0 +1,48 @@ +package edu.ntnu.idi.idatt2003.gruppe42.View; + +import javafx.geometry.Pos; +import javafx.scene.control.Button; +import javafx.scene.control.Label; +import javafx.scene.control.TextField; +import javafx.scene.image.Image; +import javafx.scene.image.ImageView; +import javafx.scene.layout.StackPane; +import javafx.scene.layout.VBox; + +import java.util.Objects; + +public class StartScreen { + + public StackPane getRoot() { + // Root + StackPane root = new StackPane(); + + // Main content + VBox content = new VBox(); + content.setAlignment(Pos.CENTER); + + // Logo + Image logoImage = new Image(Objects.requireNonNull(getClass().getResourceAsStream("/images/logo.jpg"))); + ImageView logoView = new ImageView(logoImage); + logoView.setPreserveRatio(true); + logoView.setFitWidth(250); + + // User input content + VBox inputContent = new VBox(); + inputContent.setAlignment(Pos.CENTER); + inputContent.setMaxWidth(400); + + Label usernameLabel = new Label("State your name, G"); + TextField usernameField = new TextField(); + Label startingMoneyLabel = new Label("How much matrix money?"); + TextField startingMoneyField = new TextField(); + Button loginButton = new Button("Login"); + + // Set children + inputContent.getChildren().addAll(usernameLabel, usernameField, startingMoneyLabel, startingMoneyField); + content.getChildren().addAll(logoView, inputContent, loginButton); + root.getChildren().add(content); + + return root; + } +} diff --git a/src/main/resources/Images/logo.jpg b/src/main/resources/Images/logo.jpg new file mode 100644 index 0000000..f121c02 Binary files /dev/null and b/src/main/resources/Images/logo.jpg differ