Skip to content
Snippets Groups Projects
Commit 8e979ce8 authored by Anders Emil Bergan's avatar Anders Emil Bergan
Browse files

Here is a version where the program finds the fxml file and runs correctly....

Here is a version where the program finds the fxml file and runs correctly. Nothing after first window popup
parent d82555d2
No related branches found
No related tags found
1 merge request!6Merging the frontend baseline to get up to date with the progress
Pipeline #202822 passed
......@@ -88,7 +88,7 @@ loadScripts(document, 'script');</script>
<h1 title="Class MyApp" class="title">Class MyApp</h1>
</div>
<div class="inheritance" title="Inheritance Tree"><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">java.lang.Object</a>
<div class="inheritance">no.ntnu.idatt1002.demo.MyApp</div>
<div class="inheritance">no.ntnu.idatt1002.demo.view.MyApp</div>
</div>
<section class="class-description" id="class-description">
<hr>
......
......@@ -2,7 +2,7 @@
<html lang="en">
<head>
<!-- Generated by javadoc (19) on Thu Feb 02 10:19:17 CET 2023 -->
<title>Uses of Class no.ntnu.idatt1002.demo.MyApp (demo 1.0-SNAPSHOT API)</title>
<title>Uses of Class no.ntnu.idatt1002.demo.view.MyApp (demo 1.0-SNAPSHOT API)</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="dc.created" content="2023-02-02">
......@@ -50,9 +50,9 @@ loadScripts(document, 'script');</script>
<div class="flex-content">
<main role="main">
<div class="header">
<h1 title="Uses of Class no.ntnu.idatt1002.demo.MyApp" class="title">Uses of Class<br>no.ntnu.idatt1002.demo.MyApp</h1>
<h1 title="Uses of Class no.ntnu.idatt1002.demo.view.MyApp" class="title">Uses of Class<br>no.ntnu.idatt1002.demo.view.MyApp</h1>
</div>
No usage of no.ntnu.idatt1002.demo.MyApp</main>
No usage of no.ntnu.idatt1002.demo.view.MyApp</main>
<footer role="contentinfo">
<hr>
<p class="legal-copy"><small>Copyright &#169; 2023. All rights reserved.</small></p>
......
......@@ -152,7 +152,7 @@
<archive>
<manifest>
<mainClass>
no.ntnu.idatt1002.demo.MyApp
no.ntnu.idatt1002.demo.view.MyApp
</mainClass>
</manifest>
</archive>
......@@ -172,7 +172,7 @@
<!-- Default configuration for running with: mvn clean javafx:run -->
<id>default-cli</id>
<configuration>
<mainClass>no.ntnu.idatt1002.demo/no.ntnu.idatt1002.demo.MyApp</mainClass>
<mainClass>no.ntnu.idatt1002.demo/no.ntnu.idatt1002.demo.view.MyApp</mainClass>
<launcher>app</launcher>
<jlinkZipName>app</jlinkZipName>
<jlinkImageName>app</jlinkImageName>
......
package no.ntnu.idatt1002.demo;
package no.ntnu.idatt1002.demo.view;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
......@@ -6,22 +6,17 @@ import javafx.stage.Stage;
import javafx.scene.Parent;
import javafx.scene.Scene;
import java.util.Objects;
import java.io.IOException;
public class MyApp extends Application {
@Override
public void start(Stage stage) {
try {
Parent root = FXMLLoader.load(Objects.requireNonNull(getClass().getResource("FirstMenu.fxml")));
public void start(Stage stage) throws IOException {
FXMLLoader loader = new FXMLLoader(getClass().getResource("/view/FirstMenu.fxml"));
Parent root = loader.load();
Scene scene = new Scene(root);
stage.setScene(scene);
stage.show();
} catch(Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
launch(args);
......
package no.ntnu.idatt1002.demo;
package no.ntnu.idatt1002.demo.view;
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;
......@@ -16,17 +15,17 @@ public class sceneController {
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);
FXMLLoader loader = new FXMLLoader(getClass().getResource("/view/FirstMenu.fxml"));
Parent root = loader.load();
Scene 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);
FXMLLoader loader = new FXMLLoader(getClass().getResource("/view/NewBudget.fxml"));
Parent root = loader.load();
Scene scene = new Scene(root);
stage.setScene(scene);
stage.show();
}
......
.label {
-fx-font-size: 60px;
}
.outline.label .text {
-fx-fill: white;
-fx-stroke: black;
-fx-stroke-width: 2px;
}
\ No newline at end of file
<?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>
<?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="600" maxWidth="607.0" minHeight="406.0" minWidth="600" prefHeight="406.0" prefWidth="607.0" xmlns="http://javafx.com/javafx/19" xmlns:fx="http://javafx.com/fxml/1" fx:controller="no.ntnu.idatt1002.demo.view.sceneController">
<ImageView fitHeight="412.0" fitWidth="614.0" layoutX="-7.0" layoutY="-6.0" pickOnBounds="true" smooth="false">
<Image url="@../Images/backgroundMini.jpg" />
</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" onAction="#switchNewBudget" 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>
</AnchorPane>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment