Application.java (1539B) download
1package nl.isygameclient;
2
3import javafx.stage.Stage;
4import nl.isygameclient.util.StageHandler;
5import nl.isygameclient.views.GameCardControl;
6
7import java.util.List;
8
9/**
10 * This class is the start of the javafx application.
11 * It holds the main function that launches this class.
12 * As well as the start function that handles the application initialization.
13 *
14 * @author Niels Jager
15 * @author Arend Koens
16 * @author Johs Mulder
17 * @author Friedel Schön
18 */
19public class Application extends javafx.application.Application {
20
21 public static final List<GameCardControl> GAMES = List.of(
22 new GameCardControl("Tic Tac Toe", "/nl/isygameclient/imgs/tictactoe_logo.png", "/nl/isygameclient/views/games/tictactoe/TicTacToeMainMenu.fxml"),
23 new GameCardControl("Othello", "/nl/isygameclient/imgs/othello_logo.png", "/nl/isygameclient/views/games/othello/OthelloMainMenu.fxml"));
24
25 public static void main(String[] args) {
26 launch();
27 }
28
29 /**
30 * The start preforms the initialization of the stage.
31 *
32 * @param stage a javafx stage.
33 */
34 @Override
35 public void start(Stage stage) {
36 StageHandler stageHandler = StageHandler.get();
37 stageHandler.loadStages();
38
39 stageHandler.changeSceneOfStage(Window.APP, "/nl/isygameclient/views/app.fxml");
40 stageHandler.focusStage(Window.APP);
41
42 stageHandler.getStage(Window.APP).setOnCloseRequest((e) -> {
43 stageHandler.saveStages();
44 stageHandler.closeStages();
45 });
46 }
47
48
49}