package visualiser.app; import javafx.application.Application; import javafx.application.Platform; import javafx.event.EventHandler; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.image.Image; import javafx.stage.Stage; import javafx.stage.WindowEvent; import visualiser.Controllers.MainController; public class App extends Application { private static Stage stage; /** * Entry point for running the programme * * @param args for starting the programme */ public static void main(String[] args) { launch(args); } /** * Method that displays the visualiser, starting with the title screen. * @param stage the stage to be displayed * @throws Exception if something wrong with title screen */ public void start(Stage stage) throws Exception { stage.setOnCloseRequest(new EventHandler() { @Override public void handle(WindowEvent event) { Platform.exit(); System.exit(0); } }); FXMLLoader loader = new FXMLLoader(getClass().getResource("/visualiser/scenes/main.fxml")); Parent root = loader.load(); stage.setResizable(false); MainController mc = (MainController) loader.getController(); mc.enterTitle(); Scene scene = new Scene(root); stage.setScene(scene); stage.setTitle("RaceVision - Team 7"); stage.getIcons().add(new Image(getClass().getClassLoader().getResourceAsStream("images/SailIcon.png"))); mc.startCss(); setStage(stage); stage.show(); } public static Stage getStage() { return App.stage; } public static void setStage(Stage stage) { App.stage = stage; } }