Skip to content

Commit

Permalink
Merge pull request #66 from einaskoi/einar/startWindow
Browse files Browse the repository at this point in the history
implement basic start screen without styling
  • Loading branch information
peretr authored Apr 10, 2026
2 parents 19154a8 + 2141d28 commit cd3ae1e
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 2 deletions.
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.

0 comments on commit cd3ae1e

Please sign in to comment.