Java Code Examples for javafx.scene.control.Alert#AlertType
The following examples show how to use
javafx.scene.control.Alert#AlertType .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ServiceWindow.java From ns-usbloader with GNU General Public License v3.0 | 6 votes |
/** Real window creator */ private static void getNotification(String title, String body, Alert.AlertType type){ Alert alertBox = new Alert(type); alertBox.setTitle(title); alertBox.setHeaderText(null); alertBox.setContentText(body); alertBox.getDialogPane().setMinWidth(Region.USE_PREF_SIZE); alertBox.getDialogPane().setMinHeight(Region.USE_PREF_SIZE); alertBox.setResizable(true); // Java bug workaround for JDR11/OpenJFX. TODO: nothing. really. alertBox.getDialogPane().getStylesheets().add(AppPreferences.getInstance().getTheme()); Stage dialogStage = (Stage) alertBox.getDialogPane().getScene().getWindow(); dialogStage.setAlwaysOnTop(true); dialogStage.getIcons().addAll( new Image("/res/warn_ico32x32.png"), new Image("/res/warn_ico48x48.png"), new Image("/res/warn_ico64x64.png"), new Image("/res/warn_ico128x128.png") ); alertBox.show(); dialogStage.toFront(); }
Example 2
Source File: ConfirmationDialog.java From G-Earth with MIT License | 5 votes |
public static Alert createAlertWithOptOut(Alert.AlertType type, String dialogKey, String title, String headerText, String message, String optOutMessage, /*Callback<Boolean, Void> optOutAction,*/ ButtonType... buttonTypes) { Alert alert = new Alert(type); // Need to force the alert to layout in order to grab the graphic, // as we are replacing the dialog pane with a custom pane alert.getDialogPane().applyCss(); Node graphic = alert.getDialogPane().getGraphic(); // Create a new dialog pane that has a checkbox instead of the hide/show details button // Use the supplied callback for the action of the checkbox alert.setDialogPane(new DialogPane() { @Override protected Node createDetailsButton() { CheckBox optOut = new CheckBox(); optOut.setText(optOutMessage); optOut.setOnAction(event -> { if (optOut.isSelected()) { ignoreDialogs.add(dialogKey); } }); return optOut; } }); alert.getDialogPane().getButtonTypes().addAll(buttonTypes); alert.getDialogPane().setContentText(message); // Fool the dialog into thinking there is some expandable content // a Group won't take up any space if it has no children alert.getDialogPane().setExpandableContent(new Group()); alert.getDialogPane().setExpanded(true); // Reset the dialog graphic using the default style alert.getDialogPane().setGraphic(graphic); alert.setTitle(title); alert.setHeaderText(headerText); return alert; }
Example 3
Source File: AlertHelper.java From javase with MIT License | 5 votes |
public static void showAlert(Alert.AlertType alertType, Window owner, String title, String message) { Alert alert = new Alert(alertType); alert.setTitle(title); alert.setHeaderText(null); alert.setContentText(message); alert.initOwner(owner); alert.show(); }
Example 4
Source File: AlertHelper.java From javase with MIT License | 5 votes |
public static void showAlert(Alert.AlertType alertType, Window owner, String title, String message) { Alert alert = new Alert(alertType); alert.setTitle(title); alert.setHeaderText(null); alert.setContentText(message); alert.initOwner(owner); alert.show(); }
Example 5
Source File: AlertHelper.java From javase with MIT License | 5 votes |
public static void showAlert(Alert.AlertType alertType, Window owner, String title, String message) { Alert alert = new Alert(alertType); alert.setTitle(title); alert.setHeaderText(null); alert.setContentText(message); alert.initOwner(owner); alert.show(); }
Example 6
Source File: Main.java From pdf-bookmark with MIT License | 5 votes |
private void showDialog(String title, String header, String content, Alert.AlertType alertType) { Alert alert = new Alert(alertType); alert.setContentText(content); alert.setTitle(title); alert.setHeaderText(header); alert.show(); }
Example 7
Source File: Dialogs.java From xdat_editor with MIT License | 5 votes |
public static void showException(Alert.AlertType alertType, String title, String text, Throwable ex) { Platform.runLater(() -> { Alert alert = new Alert(alertType); alert.setTitle(title); alert.setHeaderText(null); alert.setContentText(text); if (SHOW_STACKTRACE && ex != null) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); ex.printStackTrace(pw); String exceptionText = sw.toString(); Label label = new Label("Exception stacktrace:"); TextArea textArea = new TextArea(exceptionText); textArea.setEditable(false); textArea.setWrapText(true); textArea.setMaxWidth(Double.MAX_VALUE); textArea.setMaxHeight(Double.MAX_VALUE); GridPane.setVgrow(textArea, Priority.ALWAYS); GridPane.setHgrow(textArea, Priority.ALWAYS); GridPane expContent = new GridPane(); expContent.setMaxWidth(Double.MAX_VALUE); expContent.add(label, 0, 0); expContent.add(textArea, 0, 1); alert.getDialogPane().setExpandableContent(expContent); } alert.showAndWait(); }); }
Example 8
Source File: JavaFxMessageBox.java From chat-socket with MIT License | 5 votes |
private Alert.AlertType getAlertType(MessageType type) { switch (type) { case Error: return Alert.AlertType.ERROR; case Info: return Alert.AlertType.INFORMATION; } return Alert.AlertType.NONE; }
Example 9
Source File: Calert.java From FakeImageDetection with GNU General Public License v3.0 | 5 votes |
public static void showAlert(String title, String Content, Alert.AlertType alertType) { Alert alert = new Alert(alertType); alert.setTitle(title); alert.setHeaderText(null); alert.setContentText(Content); alert.showAndWait(); }
Example 10
Source File: WebmapKeywordSearchController.java From arcgis-runtime-samples-java with Apache License 2.0 | 5 votes |
/** * Display an alert to the user with the specified information. * @param title alert title * @param description alert content description * @param type alert type */ private void showMessage(String title, String description, Alert.AlertType type) { Alert alert = new Alert(type); alert.setTitle(title); alert.setContentText(description); alert.show(); }
Example 11
Source File: GuiUtils.java From TerasologyLauncher with Apache License 2.0 | 5 votes |
private static void showMessageDialog(Alert.AlertType type, String title, String message, Stage owner) { FutureTask<Void> dialog = new FutureTask<>(() -> { final Alert alert = new Alert(type); alert.setTitle(title); alert.setContentText(message); alert.initOwner(owner); alert.showAndWait(); return null; }); Platform.runLater(dialog); }
Example 12
Source File: TrexAlertBuilder.java From trex-stateless-gui with Apache License 2.0 | 4 votes |
public TrexAlertBuilder setType(Alert.AlertType type) { alert.setAlertType(type); return this; }
Example 13
Source File: DetailedAlert.java From xltsearch with Apache License 2.0 | 4 votes |
DetailedAlert(Alert.AlertType alertType) { super(alertType); }
Example 14
Source File: DetailedAlert.java From xltsearch with Apache License 2.0 | 4 votes |
DetailedAlert(Alert.AlertType alertType, String contentText, ButtonType... buttons) { super(alertType, contentText, buttons); }
Example 15
Source File: PainteraAlerts.java From paintera with GNU General Public License v2.0 | 2 votes |
/** * * delegates to {@link #alert(Alert.AlertType, boolean)} with {@code isResizable = true}. * * @param type type of alert * @return {@link Alert} with the title set to {@link Paintera.Constants#NAME} */ public static Alert alert(final Alert.AlertType type) { return alert(type, true); }