-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
37 lines (31 loc) · 1.05 KB
/
Main.java
File metadata and controls
37 lines (31 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package application;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.stage.Stage;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.image.Image;
public class Main extends Application {
@Override
public void start(Stage stage) {
try {
FXMLLoader loader = new FXMLLoader(getClass().getResource("Main.fxml")); // Loading FXML File
String cssPath = this.getClass().getResource("application.css").toExternalForm();
Parent root = loader.load();
Scene scene = new Scene(root); // Adding it to scene
scene.getStylesheets().add(cssPath);
stage.setTitle("AVL Tree Visualiser"); // Adding the title in stage
Image icon = new Image("favico.png");
stage.getIcons().add(icon);
stage.setResizable(false);
stage.setMaximized(true);
stage.setScene(scene); // Set scene on stage
stage.show(); // Show scene
} catch(Exception e) {
e.printStackTrace(); // Handle exceptions
}
}
public static void main(String[] args) {
launch(args); // launch through main method
}
}