diff --git a/src/main/java/no/ntnu/idatt1002/demo/MyApp.java b/src/main/java/no/ntnu/idatt1002/demo/MyApp.java index 360e1f3cbe11936d41f76c84f292e2a36922d105..161a37c0f926950de18190b79269fb4150448b72 100644 --- a/src/main/java/no/ntnu/idatt1002/demo/MyApp.java +++ b/src/main/java/no/ntnu/idatt1002/demo/MyApp.java @@ -8,11 +8,12 @@ import no.ntnu.idatt1002.demo.view.MyWindow; */ public class MyApp { + static StartMenu menu = new StartMenu(); + /** * Main method for my application */ public static void main(String[] args) throws Exception { - MyWindow window = new MyWindow("The Window"); - window.setVisible(true); + menu.start(); } } diff --git a/src/main/java/no/ntnu/idatt1002/demo/StartMenu.java b/src/main/java/no/ntnu/idatt1002/demo/StartMenu.java new file mode 100644 index 0000000000000000000000000000000000000000..944594fda858165729bb53891292de084c0fcd14 --- /dev/null +++ b/src/main/java/no/ntnu/idatt1002/demo/StartMenu.java @@ -0,0 +1,60 @@ +package no.ntnu.idatt1002.demo; + +import javafx.application.Application; +import javafx.geometry.Insets; +import javafx.geometry.Pos; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.image.Image; +import javafx.scene.image.ImageView; +import javafx.scene.layout.*; +import javafx.scene.text.*; +import javafx.stage.Stage; +import java.io.FileInputStream; +import java.io.IOException; + + +public class StartMenu extends Application{ + + @Override + public void start(Stage primaryStage) throws IOException { + primaryStage.setTitle("BudgetBuddy"); + ImageView bck = new ImageView(new Image(new FileInputStream("src/main/resources/Defaults/budgetbuddycover.jpeg"))); + bck.setPreserveRatio(true); + bck.setFitWidth(750); + + + StackPane pane = new StackPane(); + HBox buttons = new HBox(); + VBox layout = new VBox(); + Button opt1 = new Button("Start New Budget"); + Button opt2 = new Button("Continue Ongoing Budget"); + opt1.setPadding(new Insets(20,100,20,100)); + opt2.setPadding(new Insets(20,100,20,100)); + buttons.getChildren().addAll(opt1, opt2); + buttons.setAlignment(Pos.CENTER); + buttons.setSpacing(75); + + Text text = new Text(); + String textContent = "BudgetBuddy"; + text.setText(textContent); + text.setFont(Font.font("verdana", FontWeight.BOLD, FontPosture.REGULAR, 60)); + + + layout.getChildren().addAll(text, buttons); + layout.setAlignment(Pos.CENTER); + layout.setSpacing(100); + + pane.getChildren().addAll(bck, layout); + Scene scene = new Scene(pane); + primaryStage.setScene(scene); + + primaryStage.setResizable(false); + primaryStage.show(); + } + + public void start() { + start(); + } +} + diff --git a/src/main/java/no/ntnu/idatt1002/demo/UI.java b/src/main/java/no/ntnu/idatt1002/demo/UI.java deleted file mode 100644 index 667dbd06ba1760db457003baaa455072e60200f3..0000000000000000000000000000000000000000 --- a/src/main/java/no/ntnu/idatt1002/demo/UI.java +++ /dev/null @@ -1,74 +0,0 @@ -package no.ntnu.idatt1002.demo; - -import javafx.application.Application; -import javafx.geometry.Pos; -import javafx.scene.Scene; -import javafx.scene.control.Button; -import javafx.scene.image.Image; -import javafx.scene.image.ImageView; -import javafx.scene.layout.*; -import javafx.stage.Stage; - -import javafx.scene.control.Label; - -import java.io.FileInputStream; -import java.io.InputStream; - -public class UI extends Application{ - - @Override - public void start(Stage stage) throws Exception { - Label label = new Label("Title"); - - VBox rootV = new VBox(); - HBox rootH = new HBox(); - Scene scene = new Scene(rootH, 500, 500); - - Button btnNormal = new Button("_Normal"); - Button btnDefault = new Button("_Default"); - Button btnCancel = new Button("_Cancel"); - btnDefault.setDefaultButton(true); - btnCancel.setCancelButton(true); - - btnNormal.setOnAction(event ->{ - normalButton(); - }); - btnDefault.setOnAction(event ->{ - defaultButton(); - }); - btnCancel.setOnAction(event ->{ - cancelButton(); - }); - - ImageView bck = new ImageView(new Image(new FileInputStream("src/main/resources/Defaults/Journey.png"))); - rootH.getChildren().add(bck); - - rootH.getChildren().addAll(btnNormal, btnDefault, btnCancel); - rootH.setAlignment(Pos.BOTTOM_CENTER); - rootH.setSpacing(10); - rootV.getChildren().add(rootH); - - - stage.setScene(scene); - stage.setTitle("Menu"); - stage.show(); - } - - private void normalButton(){ - System.out.println("Button activated for normal"); - } - - private void defaultButton(){ - System.out.println("Button activated for default"); - } - - private void cancelButton(){ - System.out.println("Button activated for cancel"); - } - - public static void main(String[] args) { - launch(args); - } - - -} diff --git a/src/main/resources/Defaults/Journey.png b/src/main/resources/Defaults/Journey.png deleted file mode 100644 index b355bd7f126d8b771b674675a542a9b8a2faf661..0000000000000000000000000000000000000000 Binary files a/src/main/resources/Defaults/Journey.png and /dev/null differ diff --git a/src/main/resources/Defaults/budgetbuddycover.jpeg b/src/main/resources/Defaults/budgetbuddycover.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..75e7f244e9d27b0416904cef73a52d3d88111f20 Binary files /dev/null and b/src/main/resources/Defaults/budgetbuddycover.jpeg differ