-
Notifications
You must be signed in to change notification settings - Fork 0
/
Application.java
42 lines (37 loc) · 1.24 KB
/
Application.java
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
import javafx.application.Platform;
import javafx.embed.swing.JFXPanel;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.stage.Stage;
public class Application
{
public static DatabaseConnection database;
public static void main(String[] args)
{
JFXPanel panel = new JFXPanel();
Platform.runLater(() -> start());
}
public static void start()
{
try
{
database = new DatabaseConnection("SampleProject.db");
FXMLLoader loader = new FXMLLoader(Application.class.getResource("LoginScene.fxml"));
Stage stage = new Stage();
stage.setTitle("Login Demo");
stage.setScene(new Scene(loader.load()));
stage.show();
loginController controller = loader.getController();
controller.prepareStageEvents(stage);
}
catch (Exception ex) // If anything goes wrong starting the application then call the terminate method.
{
System.out.println(ex.getMessage());
terminate();
}
}
public static void terminate()
{
System.exit(0);
}
}