0% found this document useful (0 votes)
32 views2 pages

App Java

The document contains a Java class named 'App' that extends the JavaFX Application class. It sets up a basic user interface for a Budget Management Application by loading an FXML layout and displaying it in a window of size 1000x700. The main method launches the JavaFX application.

Uploaded by

meiyingtham8
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views2 pages

App Java

The document contains a Java class named 'App' that extends the JavaFX Application class. It sets up a basic user interface for a Budget Management Application by loading an FXML layout and displaying it in a window of size 1000x700. The main method launches the JavaFX application.

Uploaded by

meiyingtham8
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

5/7/25, 9:42 PM App.

java

src/main/java/tham/seven/App.java

1 package tham.seven;
2
3 import javafx.application.Application;
4 import javafx.fxml.FXMLLoader;
5 import javafx.scene.Scene;
6 import javafx.scene.layout.HBox;
7 import javafx.stage.Stage;
8
9 public class App extends Application {
10
11 @Override
12 public void start(Stage stage) throws Exception {
13 // Load the FXML layout file located in the same package
14 FXMLLoader fxmlLoader = new FXMLLoader(App.class.getResource("primary.fxml"));
15
16 // Load and cast the root node to HBox (since the FXML's root element is <HBox>)
17 HBox root = fxmlLoader.load();
18
19 // Create the Scene using the loaded root node, with width 1000 and height 700
20 Scene scene = new Scene(root, 1000, 700);
21
22 // Set the window title
23 stage.setTitle("Budget Management Application");
24
25 // Attach the scene to the stage (window)
26 stage.setScene(scene);
27
28 // Display the window
29 stage.show();
30 }
31
32 public static void main(String[] args) {
33 // Launch the JavaFX application
34 launch();
35 }
36 }
localhost:62762/e170abeb-02dc-4f7c-bae6-782781284486/ 1/2
5/7/25, 9:42 PM App.java
37

localhost:62762/e170abeb-02dc-4f7c-bae6-782781284486/ 2/2

You might also like