public boolean showChapitreAddDialog(Chapitre chapitre, int id) { try { // Load the fxml file and create a new stage for the popup dialog. FXMLLoader loader = new FXMLLoader(); loader.setLocation(MainApp.class.getResource("/fxml/addChapitre.fxml")); AnchorPane page = (AnchorPane) loader.load(); // Create the dialog Stage. Stage dialogStage = new Stage(); dialogStage.setTitle("Ajouter un Cours"); dialogStage.initModality(Modality.APPLICATION_MODAL); dialogStage.initStyle(StageStyle.UTILITY); dialogStage.initOwner(primaryStage); Scene scene = new Scene(page); dialogStage.setScene(scene); // Set the cours into the controller. AddChapitreController controller = loader.getController(); controller.setDialogStage(dialogStage); controller.setChapitre(chapitre, id); // Show the dialog and wait until the user closes it dialogStage.showAndWait(); return controller.isOkClicked(); } catch (IOException e) { e.printStackTrace(); return false; } }
/** * Displays dialog that allows user to select local text file to display in TextArea * * @param ta - reference to TextArea to display loaded text file */ public void showLoadFileDialog(AutoSpellingTextArea ta) { try { // Load the fxml file and create a new stage for the popup FXMLLoader loader = new FXMLLoader(MainApp.class.getResource("view/LoadFileLayout.fxml")); VBox page = (VBox) loader.load(); Stage dialogStage = new Stage(); dialogStage.setTitle("Load File"); dialogStage.initModality(Modality.WINDOW_MODAL); dialogStage.initOwner(primaryStage); Scene scene = new Scene(page); dialogStage.setScene(scene); // Set reference to stage in controller LoadFileDialogController controller = loader.getController(); controller.setDialogStage(dialogStage); // give controller reference to text area to load file into controller.setTextArea(ta); // Show the dialog and wait until the user closes it dialogStage.showAndWait(); } catch (IOException e) { // Exception gets thrown if the fxml file could not be loaded e.printStackTrace(); } }
private void initialiseEditConnectionsWindow() { // This is a dirty way to reload connection settings :) possibly could be removed if all // connections are closed before loading a new config file if (editConnectionsController != null) { eventManager.deregisterConnectionStatusObserver(editConnectionsController); } final FXMLLoader loader = FxmlUtils.createFxmlLoaderForProjectFile("EditConnectionsWindow.fxml"); final AnchorPane connectionWindow = FxmlUtils.loadAnchorPane(loader); editConnectionsController = ((EditConnectionsController) loader.getController()); editConnectionsController.setMainController(this); editConnectionsController.setEventManager(eventManager); editConnectionsController.setConnectionManager(connectionManager); editConnectionsController.setConfigurationManager(configurationManager); editConnectionsController.init(); Scene scene = new Scene(connectionWindow); scene.getStylesheets().addAll(mainPane.getScene().getStylesheets()); editConnectionsStage = new Stage(); editConnectionsStage.setTitle("Connection list"); editConnectionsStage.initModality(Modality.WINDOW_MODAL); editConnectionsStage.initOwner(getParentWindow()); editConnectionsStage.setScene(scene); }
public SQLHistorySearchCtrl( SQLTextAreaServices sqlTextAreaServices, Session session, ObservableList<SQLHistoryEntry> items) { _sqlTextAreaServices = sqlTextAreaServices; FxmlHelper<SQLHistorySearchView> fxmlHelper = new FxmlHelper<>(SQLHistorySearchView.class); _view = fxmlHelper.getView(); _dialog = new Stage(); _dialog.setTitle( new I18n(getClass()) .t("SQLHistorySearchCtrl.title", session.getMainTabContext().getSessionTabTitle())); _dialog.initModality(Modality.WINDOW_MODAL); _dialog.initOwner(AppState.get().getPrimaryStage()); Region region = fxmlHelper.getRegion(); _dialog.setScene(new Scene(region)); GuiUtils.makeEscapeClosable(region); new StageDimensionSaver( "sqlhistorysearch", _dialog, new Pref(getClass()), region.getPrefWidth(), region.getPrefHeight(), _dialog.getOwner()); _view.cboFilterType.setItems( FXCollections.observableList(Arrays.asList(SqlHistoryFilterType.values()))); _view.cboFilterType.getSelectionModel().selectFirst(); _view.btnApply.setOnAction(e -> onApply()); _view.chkFiltered.setOnAction(e -> onChkFiltered()); _view.split.getItems().add(_tblHistory); _view.split.getItems().add(_txtSqlPreview); _originalTableLoader = new RowObjectTableLoader<>(); _originalTableLoader.initColsByAnnotations(SQLHistoryEntry.class); _originalTableLoader.addRowObjects(items); _currentLoader = _originalTableLoader.cloneLoader(); _currentLoader.load(_tblHistory); _tblHistory .getSelectionModel() .selectedItemProperty() .addListener((observable, oldValue, newValue) -> onTableSelectionChanged()); _tblHistory.setOnMouseClicked(e -> onTblHistoryClicked(e)); _txtSqlPreview.setEditable(false); _dialog.setOnCloseRequest(e -> close()); _view.txtFilter.requestFocus(); _splitPositionSaver.apply(_view.split); _dialog.showAndWait(); }
public DownloadDialogController showDownloadDialog(Modpack modpack) { try { FXMLLoader loader = new FXMLLoader(); loader.setLocation(TRLauncher.class.getResource("view/downloaddialog/DownloadDialog.fxml")); AnchorPane pane = loader.load(); Stage dialogStage = new Stage(); dialogStage.setTitle("Downloading Modpack"); dialogStage.initModality(Modality.WINDOW_MODAL); dialogStage.initOwner(primaryStage); Scene scene = new Scene(pane); dialogStage.setScene(scene); DownloadDialogController controller = loader.getController(); controller.setDialogStage(dialogStage); controller.setModpack(modpack); controller.setDownloadingLabelText("Downloading " + modpack.getDisplayName()); dialogStage.show(); try { Thread.sleep(4000); } catch (InterruptedException e) { e.printStackTrace(); } return controller; } catch (IOException e) { System.err.println("Couldn't find the specified layout"); e.printStackTrace(); return null; } }
public boolean showDbConnectDialog() { try { // Load the fxml file and create a new stage for the popup dialog. FXMLLoader loader = new FXMLLoader(); loader.setLocation(Main.class.getResource("view/DbConnectDialog.fxml")); AnchorPane page = (AnchorPane) loader.load(); // Create the dialog Stage. Stage dialogStage = new Stage(); dialogStage.setTitle("Під'єднання до БД"); dialogStage.initModality(Modality.WINDOW_MODAL); dialogStage.initOwner(primaryStage); Scene scene = new Scene(page); dialogStage.setScene(scene); // Set the person into the controller. sample.view.DbConnectDialogController controller = loader.getController(); controller.setDialogStage(dialogStage); controller.setConnectField(); // Set the dialog icon. dialogStage.getIcons().add(new Image("file:resources/images/edit.png")); // Show the dialog and wait until the user closes it dialogStage.showAndWait(); return controller.isOkClicked(); } catch (IOException e) { e.printStackTrace(); return false; } }
private void showError(List<String> errorList) { String msg = ""; if (errorList.isEmpty()) { msg = "No message to display."; } else { for (String s : errorList) { msg = msg + s + "\n"; } } Label msgLbl = new Label(msg); Button okBtn = new Button("OK"); VBox root = new VBox(new StackPane(msgLbl), new StackPane(okBtn)); root.setSpacing(10); Scene scene = new Scene(root); Stage stage = new Stage(StageStyle.UTILITY); stage.initModality(Modality.WINDOW_MODAL); stage.setScene(scene); stage.initOwner(view.getScene().getWindow()); // Set the Action listener for the OK button okBtn.setOnAction(e -> stage.close()); stage.setTitle("Error"); stage.sizeToScene(); stage.showAndWait(); }
public void showMarkovDialog(textgen.MarkovTextGenerator mtg) { try { // Load the fxml file and create a new stage for the popup FXMLLoader loader = new FXMLLoader(MainApp.class.getResource("view/MarkovLayout.fxml")); BorderPane page = (BorderPane) loader.load(); Stage dialogStage = new Stage(); dialogStage.setTitle("Markov Text Generator"); // dialogStage.initModality(Modality.WINDOW_MODAL); dialogStage.initOwner(primaryStage); Scene scene = new Scene(page); dialogStage.setScene(scene); // Set reference to stage in controller // BUG -- when first displayed results don't show up until resize window MarkovController controller = loader.getController(); // controller.setDialogStage(dialogStage); controller.setMainApp(this); controller.setMTG(mtg); // Show the dialog and wait until the user closes it dialogStage.showAndWait(); } catch (IOException e) { // Exception gets thrown if the fxml file could not be loaded e.printStackTrace(); } }
public static void showArchives(Stage s) { try { FXMLLoader loader = new FXMLLoader(); loader.setLocation(ShowArchives.class.getResource("./fxml/archiveView.fxml")); Parent root = (Parent) loader.load(); ShowArchives section = loader.getController(); Scene scene = new Scene(root); Stage stage = new Stage(); stage.setScene(scene); section.setParent(stage); section.loadInfo(); stage.initOwner(s); stage.initModality(Modality.APPLICATION_MODAL); stage.setResizable(false); stage.initStyle(StageStyle.UTILITY); stage.showAndWait(); } catch (IOException e) { e.printStackTrace(); } }
@Override @FXML protected void abrirModalCreate() { try { // Carrega o arquivo fxml e cria um novo stage para a janela popup. FXMLLoader loader = new FXMLLoader(); loader.setLocation(getClass().getResource("fxml/dialog/dialogFuncionario.fxml")); GridPane page = (GridPane) loader.load(); // Cria o palco dialogStage. Stage dialogStage = new Stage(); dialogStage.initModality(Modality.WINDOW_MODAL); dialogStage.initOwner(ControllerTelas.stage); Scene scene = new Scene(page); dialogStage.setScene(scene); // Define a pessoa no controller. DialogController<Funcionario> controller = loader.getController(); controller.setTipe(DialogController.CREATE_MODAL); controller.setDialogStage(dialogStage); dialogStage.setTitle(controller.getTitulo()); dialogStage.setResizable(false); // Mostra a janela e espera até o usuário fechar. dialogStage.showAndWait(); tabela.getItems().clear(); atualizarLista(); } catch (IOException e) { e.printStackTrace(); } }
private void createNewStage(int level, Stage owner, boolean onTop) { Stage stage = new Stage(); stage.initOwner(owner); stage.setTitle(level == 0 ? "Root" : "Child " + level); stage.setAlwaysOnTop(onTop); VBox root = new VBox(15); root.setPadding(new Insets(20)); Scene scene = new Scene(root); stage.setScene(scene); ToggleButton onTopButton = new ToggleButton(onTop ? DISABLE_ON_TOP : ENABLE_ON_TOP); onTopButton.setSelected(onTop); stage .alwaysOnTopProperty() .addListener( (observable, oldValue, newValue) -> { onTopButton.setSelected(newValue); onTopButton.setText(newValue ? DISABLE_ON_TOP : ENABLE_ON_TOP); }); onTopButton.setOnAction(event -> stage.setAlwaysOnTop(!stage.isAlwaysOnTop())); CheckBox box = new CheckBox("Child stage always on top"); box.setSelected(true); Button newStageButton = new Button("Open child stage"); newStageButton.setOnAction(event -> createNewStage(level + 1, stage, box.isSelected())); root.getChildren().addAll(onTopButton, box, newStageButton); stage.show(); }
public String showSetUsernameDialog() { try { FXMLLoader loader = new FXMLLoader(); loader.setLocation(TRLauncher.class.getResource("view/account/SetUsername.fxml")); AnchorPane pane = loader.load(); Stage dialogStage = MiscUtils.addIcons(new Stage()); dialogStage.setTitle("Add Account"); dialogStage.initModality(Modality.WINDOW_MODAL); dialogStage.initOwner(primaryStage); Scene scene = new Scene(pane); dialogStage.setScene(scene); SetUsernameController controller = loader.getController(); controller.setDialogStage(dialogStage); dialogStage.showAndWait(); return controller.getUsername(); } catch (IOException e) { TRLauncher.log.error("Couldn't find the specified layout"); TRLauncher.log.catching(e); Issues.create(null, e); return null; } }
public PasswordRetryDialogController showPasswordDialog(String username, String failureMessage) { try { FXMLLoader loader = new FXMLLoader(); loader.setLocation( TRLauncher.class.getResource("view/passworddialog/retry/PasswordRetryDialog.fxml")); AnchorPane pane = loader.load(); Stage dialogStage = MiscUtils.addIcons(new Stage()); dialogStage.setTitle("Login (Retry)"); dialogStage.initModality(Modality.WINDOW_MODAL); dialogStage.initOwner(primaryStage); Scene scene = new Scene(pane); dialogStage.setScene(scene); PasswordRetryDialogController controller = loader.getController(); controller.setDialogStage(dialogStage); controller.setUsername(username); controller.setFailureMessage(failureMessage); dialogStage.showAndWait(); return controller; } catch (IOException e) { TRLauncher.log.error("Couldn't find the specified layout"); TRLauncher.log.catching(e); Issues.create(null, e); return null; } }
public boolean showPersonEditDialog(Person person) { try { // Load the fxml file and create a new stage for the popup dialog. FXMLLoader loader = new FXMLLoader(); loader.setLocation(MainApp.class.getResource("view/PersonEditDialog.fxml")); AnchorPane page = (AnchorPane) loader.load(); // Create the dialog Stage. Stage dialogStage = new Stage(); dialogStage.setTitle("Edit Person"); dialogStage.initModality(Modality.WINDOW_MODAL); dialogStage.initOwner(primaryStage); Scene scene = new Scene(page); dialogStage.setScene(scene); // Set the person into the controller. PersonEditDialogController controller = loader.getController(); controller.setDialogStage(dialogStage); controller.setPerson(person); // Show the dialog and wait until the user closes it dialogStage.showAndWait(); return controller.isOkClicked(); } catch (IOException e) { e.printStackTrace(); return false; } }
/** Opens the filter window to enable filters. */ public boolean filters() { try { String filters = "/java_ebook_search/view/FiltersView.fxml"; FXMLLoader loader = new FXMLLoader(); loader.setLocation(getClass().getResource(filters)); AnchorPane page = loader.load(); Stage dialogStage = new Stage(); dialogStage.setTitle("Filters"); dialogStage.initModality(Modality.APPLICATION_MODAL); dialogStage.setResizable(false); dialogStage.initOwner(searchView.getParent().getScene().getWindow()); Scene scene = new Scene(page); dialogStage.setScene(scene); // Set the Filter into the controller. FiltersController controller = loader.getController(); controller.setDialogStage(dialogStage); if (null != filter) { controller.setFilter(filter); } // Show the dialog and wait until the user closes it dialogStage.showAndWait(); // Set Filters this.filter = controller.getFilter(); // Trigger search search(); return controller.isOkClicked(); } catch (IOException | ParseException e) { e.printStackTrace(); return false; } }
public void showEditDistanceDialog(String selectedText) { try { // Load the fxml file and create a new stage for the popup FXMLLoader loader = new FXMLLoader(MainApp.class.getResource("view/EditDistanceLayout.fxml")); VBox page = (VBox) loader.load(); Stage dialogStage = new Stage(); dialogStage.setTitle("Calculate Edit Distance"); dialogStage.initModality(Modality.WINDOW_MODAL); dialogStage.initOwner(primaryStage); Scene scene = new Scene(page); dialogStage.setScene(scene); // Set reference to stage in controller EditDistanceDialogController controller = loader.getController(); controller.setDialogStage(dialogStage); controller.setMainApp(this); controller.setField(selectedText); // give controller reference to scene (cursor) // Show the dialog and wait until the user closes it dialogStage.showAndWait(); } catch (IOException e) { // Exception gets thrown if the fxml file could not be loaded e.printStackTrace(); } }
public void onFilterActivated() { try { FXMLLoader filterDialogFile = new FXMLLoader(MainApp.class.getResource("view/FilterDialog.fxml")); ResourceBundleService.setResourceBundle(filterDialogFile); AnchorPane anchorPane = filterDialogFile.load(); Stage stage = new Stage(); stage.setResizable(false); stage.setTitle(_resources.getString("filter.dialog.title")); stage.getIcons().add(_mainApp.getApplicationIcon()); stage.initModality(Modality.WINDOW_MODAL); stage.initOwner(_mainApp.getPrimaryStage()); stage.setScene(new Scene(anchorPane)); FilterDialogController controller = filterDialogFile.getController(); controller.setMainApp(_mainApp); controller.setOwner(stage); stage.showAndWait(); } catch (IOException ioEx) { ExceptionDialog.show( _resources.getString("app.error.dialog.title"), _resources.getString("app.error.dialog.header"), _resources.getString("app.error.dialog.content.filter"), ioEx, _mainApp); } }
private void showObjectifDialog(int id) { try { // Load the fxml file and create a new stage for the popup dialog. System.out.println("hello"); FXMLLoader loader = new FXMLLoader(); loader.setLocation(MainApp.class.getResource("/fxml/displayObjectif.fxml")); AnchorPane page = (AnchorPane) loader.load(); // Create the dialog Stage. Stage dialogStage = new Stage(); dialogStage.setTitle("Objectif"); dialogStage.initModality(Modality.APPLICATION_MODAL); dialogStage.initStyle(StageStyle.UTILITY); dialogStage.initOwner(primaryStage); Scene scene = new Scene(page); dialogStage.setScene(scene); // Set the cours into the controller. DisplayObjectifController control = loader.getController(); control.setDialogStage(dialogStage); control.setObjectif(id); // Show the dialog and wait until the user closes it dialogStage.showAndWait(); } catch (IOException e) { e.printStackTrace(); } }
private void setOwner(Window owner) { Window oldOwner = dialogStage.getOwner(); if (oldOwner == null) { dialogStage.initOwner(owner); } else if (oldOwner != owner) { throw new IllegalStateException("Cannot change owner."); } }
public ServerConnectorDialog(Stage parent) { stage = new Stage(); ResourceBundle resourceBundle = ResourceBundle.getBundle(getClass().getCanonicalName()); stage.setTitle(resourceBundle.getString("dialogTitle")); stage.initModality(Modality.APPLICATION_MODAL); stage.initOwner(parent); serverConnectorView = new ServerConnectorView(stage); stage.setScene(new Scene(new Group(serverConnectorView), 500, 500)); }
private void setupSubWindow() { // Setup Stage Stage stage = new Stage(); stage.initModality(Modality.WINDOW_MODAL); stage.initOwner(this.scene.getWindow()); stage.setMinWidth(300); // Setup sub manager this.subManager = new StateManager(stage); }
public static void showTaskProgressDialog( Window ownerWindow, Task task, boolean showTaskMessage) { final Stage dialog = new Stage(); task.setOnSucceeded(event -> dialog.close()); task.setOnCancelled(event -> dialog.close()); dialog.initStyle(StageStyle.UTILITY); dialog.initModality(Modality.APPLICATION_MODAL); dialog.initOwner(ownerWindow); dialog.titleProperty().bind(task.titleProperty()); // dialog.setTitle(ResourceManager.getMessage("title.dialog.processing")); dialog.setOnCloseRequest( event -> Logger.getLogger(Dialogs.class) .info(ResourceManager.getMessage("notification.task.terminatedByUser"))); ProgressBar progressBar = new ProgressBar(0); progressBar.progressProperty().bind(task.progressProperty()); progressBar.setMaxWidth(Double.MAX_VALUE); progressBar.getStyleClass().add("dark"); Label label = new Label(ResourceManager.getMessage("label.pleaseWaitWhile")); Label taskMessage = new Label(); taskMessage.textProperty().bind(task.messageProperty()); Button cancelButton = new Button(ResourceManager.getMessage("label.button.cancel")); cancelButton.setOnAction( event -> { task.cancel(); Logger.getLogger(Dialogs.class) .info(ResourceManager.getMessage("notification.task.terminatedByUser")); }); ButtonBar buttonBar = new ButtonBar(); buttonBar.getButtons().add(cancelButton); VBox dialogVBox = new VBox(); dialogVBox.setFillWidth(true); dialogVBox.setSpacing(5); dialogVBox.setPadding(new Insets(5)); dialogVBox.setPrefSize(300, VBox.USE_COMPUTED_SIZE); dialogVBox.getChildren().add(label); if (showTaskMessage) { dialogVBox.getChildren().add(taskMessage); } dialogVBox.getChildren().add(progressBar); dialogVBox.getChildren().add(buttonBar); Scene dialogScene = new Scene(dialogVBox); dialogScene.getStylesheets().add(ResourceManager.getUIThemeStyle()); dialog.setScene(dialogScene); dialog.setResizable(false); dialog.show(); }
private void initialiseConverterWindow() { final FXMLLoader loader = FxmlUtils.createFxmlLoaderForProjectFile("ConverterWindow.fxml"); final AnchorPane converterWindow = FxmlUtils.loadAnchorPane(loader); Scene scene = new Scene(converterWindow); scene.getStylesheets().addAll(mainPane.getScene().getStylesheets()); converterStage = new Stage(); converterStage.setTitle("Converter"); converterStage.initOwner(getParentWindow()); converterStage.setScene(scene); }
public void showLoadStage(Stage loadStage, String text) { loadStage.initModality(Modality.APPLICATION_MODAL); loadStage.initOwner(primaryStage); VBox loadVBox = new VBox(20); loadVBox.setAlignment(Pos.CENTER); Text tNode = new Text(text); tNode.setFont(new Font(16)); loadVBox.getChildren().add(new HBox()); loadVBox.getChildren().add(tNode); loadVBox.getChildren().add(new HBox()); Scene loadScene = new Scene(loadVBox, 300, 200); loadStage.setScene(loadScene); loadStage.show(); }
private void showDialog() { if (editDialogStage == null) { editDialogStage = new Stage(); editDialogStage.setTitle("Редактирование записи"); editDialogStage.setMinHeight(150); editDialogStage.setMinWidth(300); editDialogStage.setResizable(false); editDialogStage.setScene(new Scene(fxmlEdit)); editDialogStage.initModality(Modality.WINDOW_MODAL); editDialogStage.initOwner(mainStage); } editDialogStage.showAndWait(); // для ожидания закрытия окна }
public INutView showNewStage(String sceneResourcePath, Stage parentStage) { FXMLLoader fxmlLoader = new FXMLLoader(); Scene stageScene = loadScene(fxmlLoader, sceneResourcePath); Stage newStage = new Stage(); newStage.setScene(stageScene); newStage.setResizable(false); if (null != parentStage) { newStage.initModality(Modality.WINDOW_MODAL); newStage.initOwner(parentStage); } newStage.show(); return fxmlLoader.getController(); }
public void personLinkButton(ActionEvent event) throws IOException { actionClose(event); Stage stage = new Stage(); fxmlLoader = new FXMLLoader(); fxmlLoader.setLocation(getClass().getResource("..\\personality.fxml")); Parent fxmlMain = fxmlLoader.load(); // Parent root = // FXMLLoader.load(getClass().getResource("C:\\Users\\Aleksandr\\IdeaProjects\\My_Tests\\GB_Desktop_App\\src\\sample\\keywords.fxml")); stage.setTitle("Справочник Личности"); stage.setMinHeight(400); stage.setMinWidth(700); stage.setScene(new Scene(fxmlMain)); // stage.initModality(Modality.WINDOW_MODAL); stage.initOwner(((Node) event.getSource()).getScene().getWindow()); stage.show(); System.out.println("Справочник Личности!"); // main.primaryStage.close(); }
@FXML private void onRegisterHyperlinkClick(ActionEvent event) { FXMLLoader loader = new FXMLLoader(); Stage dialogStage = new Stage(); Parent root = null; dialogStage.setTitle("Register for sQuire"); dialogStage.initModality(Modality.WINDOW_MODAL); dialogStage.initOwner(registerHyperlink.getScene().getWindow()); dialogStage.setResizable(false); try { root = loader.load(getClass().getResource("/fxml/RegisterDialog.fxml")); Scene scene = new Scene(root); dialogStage.setScene(scene); dialogStage.showAndWait(); } catch (Exception e) { e.printStackTrace(); } }
@Override public void start(Stage escenario) { escenario.setTitle("Responsabilidad"); escenario0 = escenario; try { FXMLLoader cargador2 = new FXMLLoader(Principal.class.getResource("DescriGralView.fxml")); cargador2.setController(new ResponsabilidadController()); AnchorPane root = (AnchorPane) cargador2.load(); escenario0.setScene(new Scene(root, Color.TRANSPARENT)); // escenario0.initStyle(StageStyle.UNDECORATED); // escenario0.setResizable(false); escenario0.initModality(Modality.NONE); escenario0.initOwner(Principal.getStagePrincipal()); escenario0.show(); System.out.println("Muestra la Ventana Responsabilidad???"); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
public void showDialog() throws IOException { URL res = EquipmentDialog.class.getResource(Const.FXML_EQUIPMENT); // Load the fxml file and create a new stage for the popup FXMLLoader loader = new FXMLLoader(res); AnchorPane page = (AnchorPane) loader.load(); Stage dialogStage = new Stage(); dialogStage.setTitle(Lang.get().text(Lang.EQUIPMENT_DLG_TITLE)); dialogStage.initModality(Modality.WINDOW_MODAL); dialogStage.initOwner(primaryStage); dialogStage.initStyle(StageStyle.UTILITY); Scene scene = new Scene(page); dialogStage.setScene(scene); // Set the controller EquipmentController controller = loader.<EquipmentController>getController(); controller.setDialogStage(dialogStage); controller.setEquipmentMan(equipmentMan); // Show the dialog and wait until the user closes it dialogStage.showAndWait(); }