Skip to content

implement basic start screen without styling #66

Merged
merged 1 commit into from
Apr 10, 2026
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/main/java/edu/ntnu/idi/idatt2003/gruppe42/Millions.java
Original file line number Diff line number Diff line change
@@ -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");
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
}
}
Binary file added src/main/resources/Images/logo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.