Search in sources :

Example 1 with FirstScreenController

use of eu.tn.controller.FirstScreenController in project TNCY-English-Project by mrngg.

the class Main method start.

@Override
public void start(Stage primaryStage) throws Exception {
    File db = new File("src/eu/tn/data/tests.txt");
    File db2 = new File("src/eu/tn/data/rules.txt");
    if (db.exists()) {
        new Database().loadTests();
    }
    if (db2.exists()) {
        new Database().loadRules();
    }
    BorderPane root = new BorderPane();
    FXMLLoader loader = new FXMLLoader();
    loader.setLocation(getClass().getResource("view/FirstScreen.fxml"));
    loader.setControllerFactory((iC -> new FirstScreenController()));
    root.setCenter(loader.load());
    primaryStage.setOnCloseRequest(event -> {
        Platform.exit();
    });
    primaryStage.setTitle("Shakespeare");
    primaryStage.setScene(new Scene(root, 800, 500));
    primaryStage.show();
}
Also used : Application(javafx.application.Application) Platform(javafx.application.Platform) Scene(javafx.scene.Scene) Stage(javafx.stage.Stage) FXMLLoader(javafx.fxml.FXMLLoader) FirstScreenController(eu.tn.controller.FirstScreenController) BorderPane(javafx.scene.layout.BorderPane) Database(eu.tn.model.Database) File(java.io.File) BorderPane(javafx.scene.layout.BorderPane) FirstScreenController(eu.tn.controller.FirstScreenController) Database(eu.tn.model.Database) Scene(javafx.scene.Scene) File(java.io.File) FXMLLoader(javafx.fxml.FXMLLoader)

Aggregations

FirstScreenController (eu.tn.controller.FirstScreenController)1 Database (eu.tn.model.Database)1 File (java.io.File)1 Application (javafx.application.Application)1 Platform (javafx.application.Platform)1 FXMLLoader (javafx.fxml.FXMLLoader)1 Scene (javafx.scene.Scene)1 BorderPane (javafx.scene.layout.BorderPane)1 Stage (javafx.stage.Stage)1