diff --git a/src/main/java/no/ntnu/idatt1002/demo/MyApp.java b/src/main/java/no/ntnu/idatt1002/demo/MyApp.java index 161a37c0f926950de18190b79269fb4150448b72..bbd3a868d144267e42c8de76ec7cd2a2e40fd6c2 100644 --- a/src/main/java/no/ntnu/idatt1002/demo/MyApp.java +++ b/src/main/java/no/ntnu/idatt1002/demo/MyApp.java @@ -1,19 +1,29 @@ package no.ntnu.idatt1002.demo; -import no.ntnu.idatt1002.demo.view.MyWindow; +import javafx.application.Application; +import javafx.fxml.FXMLLoader; +import javafx.stage.Stage; +import javafx.scene.Parent; +import javafx.scene.Scene; -/** - * Use this class to start the application - * @author nilstes - */ -public class MyApp { +import java.util.Objects; - static StartMenu menu = new StartMenu(); +public class MyApp extends Application { - /** - * Main method for my application - */ - public static void main(String[] args) throws Exception { - menu.start(); - } -} + @Override + public void start(Stage stage) { + try { + + Parent root = FXMLLoader.load(Objects.requireNonNull(getClass().getResource("FirstMenu.fxml"))); + Scene scene = new Scene(root); + stage.setScene(scene); + stage.show(); + + } catch(Exception e) { + e.printStackTrace(); + } + } + public static void main(String[] args) { + launch(args); + } +} \ No newline at end of file diff --git a/src/main/java/no/ntnu/idatt1002/demo/StartMenu.java b/src/main/java/no/ntnu/idatt1002/demo/StartMenu.java deleted file mode 100644 index 944594fda858165729bb53891292de084c0fcd14..0000000000000000000000000000000000000000 --- a/src/main/java/no/ntnu/idatt1002/demo/StartMenu.java +++ /dev/null @@ -1,60 +0,0 @@ -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/sceneController.java b/src/main/java/no/ntnu/idatt1002/demo/sceneController.java new file mode 100644 index 0000000000000000000000000000000000000000..3254c327f2e839e7c2e552c3c338cfd3252571fd --- /dev/null +++ b/src/main/java/no/ntnu/idatt1002/demo/sceneController.java @@ -0,0 +1,33 @@ +package no.ntnu.idatt1002.demo; + +import java.io.IOException; + +import javafx.event.ActionEvent; +import javafx.fxml.FXMLLoader; +import javafx.scene.Node; +import javafx.scene.Parent; +import javafx.scene.Scene; +import javafx.stage.Stage; + +public class sceneController { + + private Stage stage; + private Scene scene; + private Parent root; + + public void switchStartMenu(ActionEvent event) throws IOException { + root = FXMLLoader.load(getClass().getResource("view/StartMenu.fxml")); + stage = (Stage)((Node)event.getSource()).getScene().getWindow(); + scene = new Scene(root); + stage.setScene(scene); + stage.show(); + } + + public void switchNewBudget(ActionEvent event) throws IOException { + root = FXMLLoader.load(getClass().getResource("view/NewBudget.fxml")); + stage = (Stage)((Node)event.getSource()).getScene().getWindow(); + scene = new Scene(root); + stage.setScene(scene); + stage.show(); + } +} \ No newline at end of file diff --git a/src/main/java/no/ntnu/idatt1002/demo/view/NewBudget.fxml b/src/main/java/no/ntnu/idatt1002/demo/view/NewBudget.fxml new file mode 100644 index 0000000000000000000000000000000000000000..3105571c9455d707e03f7262dd4b15b806e381f7 --- /dev/null +++ b/src/main/java/no/ntnu/idatt1002/demo/view/NewBudget.fxml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<?import java.lang.*?> +<?import java.util.*?> +<?import javafx.scene.*?> +<?import javafx.scene.control.*?> +<?import javafx.scene.layout.*?> + +<AnchorPane xmlns="http://javafx.com/javafx" + xmlns:fx="http://javafx.com/fxml" + fx:controller="no.ntnu.idatt1002.demo.view.NewBudget" + prefHeight="400.0" prefWidth="600.0"> + +</AnchorPane> diff --git a/src/main/java/no/ntnu/idatt1002/demo/view/NewBudget.java b/src/main/java/no/ntnu/idatt1002/demo/view/NewBudget.java new file mode 100644 index 0000000000000000000000000000000000000000..2844313e33642897ff58d598a5b62e2e162c073d --- /dev/null +++ b/src/main/java/no/ntnu/idatt1002/demo/view/NewBudget.java @@ -0,0 +1,42 @@ +package no.ntnu.idatt1002.demo.view; + +import javafx.geometry.Insets; +import javafx.geometry.Pos; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.control.Label; +import javafx.scene.control.TextArea; +import javafx.scene.image.Image; +import javafx.scene.image.ImageView; +import javafx.scene.layout.HBox; +import javafx.scene.layout.Pane; +import javafx.scene.layout.StackPane; +import javafx.scene.layout.VBox; +import javafx.scene.text.Font; +import javafx.scene.text.FontPosture; +import javafx.scene.text.FontWeight; +import javafx.stage.Stage; + +import java.io.FileInputStream; +import java.io.IOException; + +public class NewBudget { + + private static StackPane root; + public static Pane getRoot() throws IOException { + + TextArea income = new TextArea(); + TextArea income2 = new TextArea(); + income.setMaxSize(200, 20); + income2.setMaxSize(200, 20); + VBox inputs = new VBox(); + inputs.getChildren().addAll(income, income2); + inputs.setAlignment(Pos.CENTER); + inputs.setSpacing(100); + + + return root; + } + +} + diff --git a/src/main/resources/CSS/outline.css b/src/main/resources/CSS/outline.css new file mode 100644 index 0000000000000000000000000000000000000000..1680a4b7e2480ae5271397b6cd8cfe1e21f2133a --- /dev/null +++ b/src/main/resources/CSS/outline.css @@ -0,0 +1,9 @@ +.label { + -fx-font-size: 60px; +} + +.outline.label .text { + -fx-fill: white; + -fx-stroke: black; + -fx-stroke-width: 2px; +} \ No newline at end of file diff --git a/src/main/resources/Defaults/backgroundMini.jpg b/src/main/resources/Defaults/backgroundMini.jpg new file mode 100644 index 0000000000000000000000000000000000000000..d67d659fd817307112ddf542096c0b5ecdb014f9 Binary files /dev/null and b/src/main/resources/Defaults/backgroundMini.jpg differ diff --git a/src/main/resources/Windows/FirstMenu.fxml b/src/main/resources/Windows/FirstMenu.fxml new file mode 100644 index 0000000000000000000000000000000000000000..853195ed01dbb4bd8f43e04c91b145c4ecb3ef2a --- /dev/null +++ b/src/main/resources/Windows/FirstMenu.fxml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<?import javafx.scene.control.Button?> +<?import javafx.scene.control.Label?> +<?import javafx.scene.image.Image?> +<?import javafx.scene.image.ImageView?> +<?import javafx.scene.layout.AnchorPane?> +<?import javafx.scene.text.Font?> + +<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1" fx:controller="no.ntnu.idatt1002.demo.sceneController"> + <children> + <ImageView fitHeight="412.0" fitWidth="614.0" layoutX="-7.0" layoutY="-6.0" pickOnBounds="true" smooth="false"> + <image> + <Image url="@../Defaults/backgroundMini.jpg" /> + </image> + </ImageView> + <Label alignment="CENTER" contentDisplay="CENTER" layoutX="73.0" layoutY="113.0" lineSpacing="1.0" text="Welcome to BudgetBuddy!" textAlignment="CENTER" textOverrun="LEADING_ELLIPSIS" wrapText="true"> + <font> + <Font name="Verdana" size="34.0" /> + </font> + </Label> + <Label ellipsisString="" layoutX="147.0" layoutY="171.0" lineSpacing="1.0" text="Please choose one of the options:" textAlignment="CENTER"> + <font> + <Font name="Verdana" size="18.0" /> + </font> + </Label> + <Button layoutX="69.0" layoutY="212.0" mnemonicParsing="false" text="New Budget"> + <font> + <Font size="24.0" /> + </font> + </Button> + <Button layoutX="380.0" layoutY="212.0" mnemonicParsing="false" text="Old Budget"> + <font> + <Font size="24.0" /> + </font> + </Button> + </children> +</AnchorPane>