-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApplication.java
More file actions
49 lines (42 loc) · 1.42 KB
/
Application.java
File metadata and controls
49 lines (42 loc) · 1.42 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
38
39
40
41
42
43
44
45
46
47
48
49
import javafx.application.Platform;
import javafx.embed.swing.JFXPanel;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.stage.Stage;
import javafx.scene.image.Image;
public class Application
{
public static DatabaseConnection database;
public static void main(String args[])
{
JFXPanel panel = new JFXPanel();
Platform.runLater(() -> start());
}
private static void start()
{
try
{
database = new DatabaseConnection("ScaleBaseDataBase.db");
FXMLLoader loader = new FXMLLoader(Application.class.getResource("Menu.fxml"));
Stage stage = new Stage();
stage.setResizable(false);
stage.setTitle("ScaleBase");
stage.setScene(new Scene(loader.load()));
stage.show();
MenuSceneController controller = loader.getController();
controller.prepareStageEvents(stage);
stage.getIcons().add(new Image("scalebaselogo.png"));
}
catch (Exception ex)
{
System.out.println(ex.getMessage());
terminate();
}
}
public static void terminate()
{
System.out.println("Closing database connection and terminating application...");
if (database != null) database.disconnect();
System.exit(0);
}
}