private void clickShow(ActionEvent event) { Stage stage = new Stage(); Parent root = FXMLLoader.load( YourClassController.class.getResource("YourClass.fxml")); stage.setScene(new Scene(root)); stage.setTitle("My modal window"); stage.initModality(Modality.WINDOW_MODAL); stage.initOwner( ((Node)event.getSource()).getScene().getWindow() ); stage.show(); }
Stage dialog = new Stage(); // populate dialog with controls. ... dialog.initOwner(parentStage); dialog.initModality(Modality.ApplicationModal); dialog.showAndWait(); // process result of dialog operation. ...
@Override public Parent loadAsModal(String name) { final Stage mainStage = requireNonNull(userInterfaceComponent.getStage()); final Stage dialog = new Stage(); final Parent root = (Parent) load(name); final Scene scene = new Scene(root); BrandUtil.applyBrandToScene(injector, scene); dialog.setTitle("About " + infoComponent.getTitle()); dialog.initModality(APPLICATION_MODAL); brand.logoSmall().map(Image::new).ifPresent(dialog.getIcons()::add); dialog.initOwner(mainStage); dialog.setScene(scene); dialog.show(); return root; } }
public void showExportXPathToRuleWizard() { ExportXPathWizardController wizard = new ExportXPathWizardController(xpathExpressionProperty()); FXMLLoader loader = new FXMLLoader(getClass().getResource("fxml/xpath-export-wizard.fxml")); loader.setController(wizard); final Stage dialog = new Stage(); dialog.initOwner(designerRoot.getMainStage()); dialog.setOnCloseRequest(e -> wizard.shutdown()); dialog.initModality(Modality.WINDOW_MODAL); Parent root; try { root = loader.load(); } catch (IOException e) { throw new RuntimeException(e); } Scene scene = new Scene(root); //stage.setTitle("PMD Rule Designer (v " + PMD.VERSION + ')'); dialog.setScene(scene); dialog.show(); }
private Stage createStage(Stage mainStage) { FXMLLoader loader = new FXMLLoader(DesignerUtil.getFxml("event-log.fxml")); loader.setController(this); final Stage dialog = new Stage(); dialog.initOwner(mainStage.getScene().getWindow()); dialog.initModality(Modality.NONE); Parent root; try { root = loader.load(); } catch (IOException e) { throw new IllegalStateException(e); } Scene scene = new Scene(root); dialog.setScene(scene); return dialog; }
stage.initOwner(parentStage); stage.initModality(Modality.WINDOW_MODAL);
private Stage createEditPropertyDialog() { EditPropertyDialogController wizard = new EditPropertyDialogController(); FXMLLoader loader = new FXMLLoader(DesignerUtil.getFxml("edit-property-dialog.fxml")); loader.setController(wizard); final Stage dialog = new Stage(); dialog.initOwner(this.getScene().getWindow()); dialog.initModality(Modality.WINDOW_MODAL); dialog.initStyle(StageStyle.UNDECORATED); Parent root; try { root = loader.load(); } catch (IOException e) { throw new IllegalStateException(e); } Scene scene = new Scene(root); dialog.setTitle("Edit property"); dialog.setScene(scene); dialog.setUserData(wizard); return dialog; }
popup.initStyle(StageStyle.UTILITY); popup.initModality(Modality.WINDOW_MODAL); popup.initOwner(designerRoot.getMainStage()); popup.show(); } catch (IOException e1) {
public JFXCustomColorPickerDialog(Window owner) { getStyleClass().add("custom-color-dialog"); if (owner != null) { dialog.initOwner(owner);
Stage stage = new Stage(); stage.initModality(Modality.WINDOW_MODAL); stage.initOwner(pane.getScene().getWindow()); stage.setScene(new Scene(content)); stage.show();
private Parent popupPane; private PopupPaneController popupPaneController; private void openPopup( ActionEvent event ) { if (popupPane == null) { popupPane = FXMLLoader.load(...); popupPaneController = // get it from FXMLLoader. Search this site for how } popupPaneController.updatePopupContent(newVals); Stage popup = new Stage(); popup.initOwner(primaryStage); stage.setScene(new ScrollPane(popupPane)); stage.show(); }
@Override public void handle(WindowEvent event) { event.consume(); // Do nothing on close request // Dialog Stage init final Stage dialog = new Stage(); dialog.initModality(Modality.APPLICATION_MODAL); dialog.initOwner(primaryStage); // other stuff } });
@FXML private void showScreen1(ActionEvent event) throws IOException { Parent root = (Parent) FXMLLoader.load(getClass().getResource("Screen1.fxml")); Scene scene = new Scene(root); Window existingWindow = ((Node) event.getSource()).getScene().getWindow(); // create a new stage: Stage stage = new Stage(); // make it modal: stage.initModality(Modality.APPLICATION_MODAL); // make its owner the existing window: stage.initOwner(existingWindow); stage.setScene(scene); stage.show(); }
@Override public void start(Stage primaryStage) throws IOException { Parent root = FXMLLoader.load(getClass().getResource("DialogView.fxml")); primaryStage.initModality(Modality.APPLICATION_MODAL); // 1 Add one Scene scene = new Scene(root); primaryStage.setScene(scene); primaryStage.initOwner(primaryStage.getScene().getWindow());// 2 Add two primaryStage.show(); } public static void main(String[] args) { launch(args); }
Stage confirmation_stage; Parent confirmation; confirmation_stage=new Stage(); FXMLLoader loader = new FXMLLoader(getClass().getResource("Confirmation.fxml")); confirmation = loader.load(); confirmation_controller controller = loader.getController(); Label label = controller.getProceedLabel(); label.setText("..."): confirmation_stage.setScene(new Scene(confirmation)); confirmation_stage.initOwner(generate_button.getScene().getWindow()); confirmation_stage.show();
Stage stage = new Stage(); stage.initModality(Modality.APPLICATION_MODAL); stage.initOwner(ownerWindow); Parent root = FXMLLoader.load(getClass().getResource("/gui/GUpdater-progress.fxml")); Scene scene = new Scene(root, 600, 400); stage.setTitle("GUpdater"); stage.setScene(scene); stage.show();
final Stage stage = new Stage(); stage.initStyle(StageStyle.UNDECORATED); stage.initOwner(owner_stage); stage.initModality(Modality.APPLICATION_MODAL);
public void openInputWindow(ActionEvent event) throws IOException { FXMLLoader loader = new FXMLLoader(getClass().getResource("GrandSon.fxml")); AnchorPane newWindow = (AnchorPane) loader.load(); GrandSonController controller = loader.getController(); controller.setMainWindow(this); Stage stage = new Stage(); stage.setTitle("Grand Son Window"); stage.initModality(Modality.WINDOW_MODAL); stage.initOwner(btnNext.getScene().getWindow()); Scene scene = new Scene(newWindow); stage.setScene(scene); stage.show(); }
Stage stage = new Stage(); stage.setTitle("Title"); stage.setResizable(false); stage.initModality(Modality.APPLICATION_MODAL); stage.initOwner(primaryStage); stage.initStyle(StageStyle.UTILITY); (...) Scene scene = new Scene(...); stage.setScene(scene);
@Override public WebEngine call(PopupFeatures param) { final Stage stage = new Stage(StageStyle.UTILITY); stage.initOwner(owner); final WebView popUpView = new WebView(); stage.setScene(new Scene(popUpView)); Title.observeView(popUpView, stage); stage.show(); return popUpView.getEngine(); } });