package digital.willers;

import javafx.application.Application;
import javafx.event.EventHandler;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.scene.layout.Pane;
import javafx.stage.Stage;
import javafx.stage.WindowEvent;
import digital.willers.gui.GUIController;

public class Main extends Application {

    @Override
    public void start(Stage primaryStage) throws Exception {

        try {

            System.out.println("Starte Initialisierung...");

            FXMLLoader loader = new FXMLLoader(getClass().getResource("/appOpener.fxml"));
            Pane root = (Pane) loader.load();
            primaryStage.setTitle("AppOpener");
            primaryStage.setScene(new Scene(root, 325, 130));
            primaryStage.setResizable(false);
            primaryStage.getIcons().add(new Image("/willers-digital-logo-klein.png"));
            primaryStage.show();

            // close app
            primaryStage.setOnCloseRequest((new EventHandler<WindowEvent>() {
                public void handle(WindowEvent we) {
                    System.exit(0);
                }
            }));
            System.out.println("Initialisierung abgeschlossen.");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        launch(args);
    }
}
