javafx.scene.control.Alert#AlertType ( )源码实例Demo

下面列出了javafx.scene.control.Alert#AlertType ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: ns-usbloader   文件: ServiceWindow.java
/** 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();
}
 
源代码2 项目: G-Earth   文件: ConfirmationDialog.java
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;
}
 
源代码3 项目: javase   文件: AlertHelper.java
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();
}
 
源代码4 项目: javase   文件: AlertHelper.java
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();
}
 
源代码5 项目: javase   文件: AlertHelper.java
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();
}
 
源代码6 项目: pdf-bookmark   文件: Main.java
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();
}
 
源代码7 项目: xdat_editor   文件: Dialogs.java
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();
    });
}
 
源代码8 项目: chat-socket   文件: JavaFxMessageBox.java
private Alert.AlertType getAlertType(MessageType type) {
    switch (type) {
        case Error:
            return Alert.AlertType.ERROR;
        case Info:
            return Alert.AlertType.INFORMATION;
    }
    return Alert.AlertType.NONE;
}
 
源代码9 项目: FakeImageDetection   文件: Calert.java
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();
}
 
/**
 * 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();
}
 
源代码11 项目: TerasologyLauncher   文件: GuiUtils.java
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);
}
 
源代码12 项目: trex-stateless-gui   文件: TrexAlertBuilder.java
public TrexAlertBuilder setType(Alert.AlertType type) {
    alert.setAlertType(type);
    return this;
}
 
源代码13 项目: xltsearch   文件: DetailedAlert.java
DetailedAlert(Alert.AlertType alertType) {
    super(alertType);
}
 
源代码14 项目: xltsearch   文件: DetailedAlert.java
DetailedAlert(Alert.AlertType alertType, String contentText, ButtonType... buttons) {
    super(alertType, contentText, buttons);
}
 
源代码15 项目: paintera   文件: PainteraAlerts.java
/**
 *
 * 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);
}