Exemplo n.º 1
0
  public static boolean showConfirmPopup(
      Node graphic, String title, String header, String content) {
    Alert alert = new Alert(Alert.AlertType.CONFIRMATION, content, ButtonType.YES, ButtonType.NO);
    if (graphic != null) {
      alert.setGraphic(graphic);
    }
    alert.setTitle(title);
    alert.setHeaderText(header);

    Optional<ButtonType> result = alert.showAndWait();
    return result.get() == ButtonType.YES;
  }
Exemplo n.º 2
0
 /* Creates an info alert dialog
  * @param string message
  */
 public void createAlert(String str) {
   Alert alert = new Alert(AlertType.INFORMATION);
   Stage stage = (Stage) alert.getDialogPane().getScene().getWindow();
   // Add corner icon
   stage.getIcons().add(new Image(this.getClass().getResource("/icons/server48.png").toString()));
   // Add Stage icon
   alert.setGraphic(new ImageView(this.getClass().getResource("/icons/server256.png").toString()));
   // alert.initOwner(stage);
   alert.setTitle("Mars Simulation Project");
   alert.setHeaderText("Multiplayer Host");
   // if (mainMenu != null) {
   //   alert.initOwner(mainMenu.getStage());
   // }
   alert.setContentText(str);
   alert.show();
 }