// Carrega o arquivo FXML, adiciona na colecao de Screens e insere o controller public void loadScreen(String name, String resource) { try { FXMLLoader loader = new FXMLLoader(getClass().getClassLoader().getResource(resource)); Parent screen = (Parent) loader.load(); ControlledScreen controller = (ControlledScreen) loader.getController(); controller.setScreenParent(this); addScreen(name, screen); } catch (Exception e) { System.err.println(e.getMessage()); } }
public void loadScreen(String name, Screens fxmlPath) { try { FXMLLoader loader = new FXMLLoader(getClass().getResource(fxmlPath.getPath())); Parent screen = (Parent) loader.load(); ControlledScreen cs = (ControlledScreen) loader.getController(); cs.setScreenController(this); cs.setAppController(appController); csMap.put(name, cs); map.put(name, screen); } catch (IOException e) { e.printStackTrace(); } }