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

finished starting point for javafx scenes

parent 8e979ce8
No related branches found
No related tags found
1 merge request!6Merging the frontend baseline to get up to date with the progress
Pipeline #202839 passed
......@@ -4,6 +4,7 @@ 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;
......@@ -14,18 +15,20 @@ public class sceneController {
private Scene scene;
private Parent root;
public void switchStartMenu(ActionEvent event) throws IOException {
FXMLLoader loader = new FXMLLoader(getClass().getResource("/view/FirstMenu.fxml"));
Parent root = loader.load();
Scene scene = new Scene(root);
root = loader.load();
stage = (Stage)((Node)event.getSource()).getScene().getWindow();
scene = new Scene(root);
stage.setScene(scene);
stage.show();
}
public void switchNewBudget(ActionEvent event) throws IOException {
FXMLLoader loader = new FXMLLoader(getClass().getResource("/view/NewBudget.fxml"));
FXMLLoader loader = new FXMLLoader(sceneController.class.getResource("/view/NewBudget.fxml"));
Parent root = loader.load();
Scene scene = new Scene(root);
stage = (Stage)((Node)event.getSource()).getScene().getWindow();
scene = new Scene(root);
stage.setScene(scene);
stage.show();
}
......
<?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">
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ListView?>
<?import javafx.scene.control.TextArea?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.text.Text?>
<AnchorPane 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.view.sceneController">
<children>
<ImageView fitHeight="400.0" fitWidth="600.0" pickOnBounds="true">
<image>
<Image url="@../Images/backgroundMini.jpg" />
</image>
</ImageView>
<ListView layoutX="133.0" layoutY="145.0" prefHeight="233.0" prefWidth="313.0" />
<TextArea layoutX="133.0" layoutY="97.0" prefHeight="39.0" prefWidth="276.0" />
<Button layoutX="409.0" layoutY="97.0" mnemonicParsing="false" prefHeight="39.0" prefWidth="38.0" text="+" />
<Text layoutX="133.0" layoutY="84.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Write your income here:" />
<Button layoutX="14.0" layoutY="14.0" mnemonicParsing="false" onAction="#switchStartMenu" text="Back" />
</children>
</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