List of usage examples for javafx.stage Modality APPLICATION_MODAL
Modality APPLICATION_MODAL
To view the source code for javafx.stage Modality APPLICATION_MODAL.
Click Source Link
From source file:snpviewer.SnpViewer.java
public void showAbout(ActionEvent ev) { try {/*from ww w.j a v a 2 s. com*/ FXMLLoader loader = new FXMLLoader(getClass().getResource("about.fxml")); Pane page = (Pane) loader.load(); Scene scene = new Scene(page); Stage stage = new Stage(); stage.setScene(scene); scene.getStylesheets().add(SnpViewer.class.getResource("SnpViewerStyleSheet.css").toExternalForm()); AboutController controller = loader.getController(); controller.setVersion(VERSION); stage.initModality(Modality.APPLICATION_MODAL); stage.getIcons().add(new Image(this.getClass().getResourceAsStream("icon.png"))); stage.setTitle("About SnpViewer"); stage.show(); } catch (Exception ex) { Dialogs.showErrorDialog(null, "Error showing about information - see" + " details for stack trace", "ERROR!", "SnpViewer", ex); } }
From source file:patientmanagerv1.HomeController.java
public void printAdv() { final Stage dialog = new Stage(); dialog.initModality(Modality.APPLICATION_MODAL); final TextField textField = new TextField(); Button submit = new Button(); Button cancel = new Button(); final Label label = new Label(); cancel.setText("Cancel"); cancel.setAlignment(Pos.CENTER);// w ww . j av a 2 s. c om submit.setText("Submit"); submit.setAlignment(Pos.BOTTOM_RIGHT); final VBox dialogVbox = new VBox(20); dialogVbox.getChildren().add(new Text("Enter the master password: ")); dialogVbox.getChildren().add(textField); dialogVbox.getChildren().add(submit); dialogVbox.getChildren().add(cancel); dialogVbox.getChildren().add(label); Scene dialogScene = new Scene(dialogVbox, 300, 200); dialog.setScene(dialogScene); dialog.setTitle("Security/Physician Authentication"); dialog.show(); submit.setOnAction(new EventHandler<ActionEvent>() { public void handle(ActionEvent anEvent) { String password = textField.getText(); if (password.equalsIgnoreCase("protooncogene")) { dialog.close(); writeEvalToDocX(false, ""); //OPENS the document for printing: try { if (Desktop.isDesktopSupported()) { Desktop.getDesktop() .open(new File(installationPath + "/userdata/" + firstName + lastName + dob + "/" + firstName + lastName + dob + "psychiatricevaluation.docx")); } } catch (IOException ioe) { ioe.printStackTrace(); } } else { label.setText("The password you entered is incorrect. Please try again."); } //adds files to file tracker } }); cancel.setOnAction(new EventHandler<ActionEvent>() { public void handle(ActionEvent anEvent) { dialog.close(); //close the window here } }); }