package com.example; import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.stage.Stage; import java.io.IOException; import java.util.List; /** * JavaFX App */ public class App extends Application { private static Scene scene; //A statikus mainController private static MainController mainController; // globális fxmlLoader: private static FXMLLoader fxmlLoader; @Override public void start(Stage stage) throws IOException { scene = new Scene(loadFXML("mainScene"), 640, 480); mainController = fxmlLoader.getController(); stage.setScene(scene); stage.show(); } @Override public void stop() throws Exception { System.out.println("stop"); List items = mainController.getListView().getItems(); Storage.writeContent(items); } static void setRoot(String fxml) throws IOException { scene.setRoot(loadFXML(fxml)); } private static Parent loadFXML(String fxml) throws IOException { //Eltávolítottuk a típust: fxmlLoader = new FXMLLoader(App.class.getResource(fxml + ".fxml")); return fxmlLoader.load(); } public static void main(String[] args) { launch(); } }