javafx.scene.control.Alert.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(7.8k)|赞(0)|评价(0)|浏览(186)

本文整理了Java中javafx.scene.control.Alert.<init>()方法的一些代码示例,展示了Alert.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Alert.<init>()方法的具体详情如下:
包路径:javafx.scene.control.Alert
类名称:Alert
方法名:<init>

Alert.<init>介绍

暂无

代码示例

代码示例来源:origin: pmd/pmd

private void showLicensePopup() {
  Alert licenseAlert = new Alert(AlertType.INFORMATION);
  licenseAlert.setWidth(500);
  licenseAlert.setHeaderText("License");
  ScrollPane scroll = new ScrollPane();
  try {
    scroll.setContent(new TextArea(IOUtils.toString(getClass().getResourceAsStream("LICENSE"),
        StandardCharsets.UTF_8)));
  } catch (IOException e) {
    e.printStackTrace();
  }
  licenseAlert.getDialogPane().setContent(scroll);
  licenseAlert.showAndWait();
}

代码示例来源:origin: speedment/speedment

@Override
public Optional<ButtonType> showWarning(String title, String message) {
  final Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
  final Scene scene = alert.getDialogPane().getScene();
  BrandUtil.applyBrand(injector, stage, scene);
  alert.setTitle("Confirmation");
  alert.setHeaderText(title);
  alert.setContentText(message);
  alert.setGraphic(FontAwesome.EXCLAMATION_TRIANGLE.view());
  return alert.showAndWait();
}

代码示例来源:origin: speedment/speedment

@Override
public void showError(String title, String message, Throwable ex) {
  final Alert alert = new Alert(Alert.AlertType.ERROR);
  final Scene scene = alert.getDialogPane().getScene();

代码示例来源:origin: Tristan971/Lyrebird

private static void displayUpdateDownloadAlert() {
  final Alert selfupdateStartedAlert = new Alert(
      Alert.AlertType.CONFIRMATION,
      "Started downloading update in the background. We will tell you when it is ready !",
      ButtonType.OK
  );
  selfupdateStartedAlert.showAndWait();
}

代码示例来源:origin: Tristan971/Lyrebird

/**
 * Displays an alert to the user informing them that the selfupdate is ready to start and they need to restart the
 * application after we automatically stop it.
 */
private static void displayRestartAlert() {
  LOG.debug("Displaying restart information alert!");
  final Alert restartAlert = new Alert(
      Alert.AlertType.INFORMATION,
      "Lyrebird has downloaded the update! " +
      "The application will automatically quit and start updating!",
      ButtonType.OK
  );
  restartAlert.showAndWait();
}

代码示例来源:origin: de.roskenet/springboot-javafx-support

/**
 * Show error alert that close app.
 *
 * @param throwable cause of error
 */
private static void showErrorAlert(Throwable throwable) {
  Alert alert = new Alert(AlertType.ERROR, "Oops! An unrecoverable error occurred.\n" +
      "Please contact your software vendor.\n\n" +
      "The application will stop now.\n\n" + 
      "Error: " + throwable.getMessage());
  alert.showAndWait().ifPresent(response -> Platform.exit());
}

代码示例来源:origin: it.unibo.alchemist/alchemist-projectview

private void setAlert(final String title, final String header, final String content) {
  final Alert alert = new Alert(AlertType.WARNING);
  alert.setTitle(RESOURCES.getString(title));
  alert.setHeaderText(RESOURCES.getString(header));
  alert.setContentText(RESOURCES.getString(content));
  alert.showAndWait();
}

代码示例来源:origin: com.powsybl/powsybl-gse-util

public static void showDraggingError() {
  Alert alert = new Alert(Alert.AlertType.ERROR);
  alert.setTitle(RESOURCE_BUNDLE.getString("DragError"));
  alert.setHeaderText(GSE_ERROR);
  alert.setContentText(RESOURCE_BUNDLE.getString("FileExists"));
  alert.showAndWait();
}

代码示例来源:origin: com.powsybl/powsybl-gse-util

public static Optional<ButtonType> showSaveAndQuitDialog(String documentName) {
  Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
  alert.setHeaderText(MessageFormat.format(RESOURCE_BUNDLE.getString("SaveBeforeClosing"), documentName));
  alert.setContentText(RESOURCE_BUNDLE.getString("WarnSaveBeforeClosing"));
  ButtonType save = new ButtonType(RESOURCE_BUNDLE.getString("Save"), ButtonBar.ButtonData.YES);
  ButtonType dontSave = new ButtonType(RESOURCE_BUNDLE.getString("DontSave"), ButtonBar.ButtonData.NO);
  alert.getButtonTypes().setAll(save, dontSave, ButtonType.CANCEL);
  return alert.showAndWait();
}

代码示例来源:origin: us.ihmc/robot-environment-awareness

private void createWarning()
  {
   Alert connectionLostAlert = new Alert(AlertType.WARNING);
   connectionLostAlert.setHeaderText("Lost connection");
   connectionLostAlert.initOwner(mainWindow);
   connectionLostAlert.showAndWait();
  }
}

代码示例来源:origin: com.github.vatbub/common.view.reporting

@FXML
void uploadLogsCheckboxOnAction(ActionEvent event) {
  if (gitHubIssue.getThrowable() != null && !uploadLogsCheckbox.isSelected()) {
    (new Alert(Alert.AlertType.WARNING, bundle.getString("uploadLogsExceptionInfo"), ButtonType.OK)).show();
  }
}

代码示例来源:origin: com.powsybl/powsybl-gse-util

public static void showDialogError(String message) {
  Alert alert = new Alert(Alert.AlertType.ERROR);
  alert.setTitle(GSE_ERROR);
  alert.setResizable(true);
  alert.setContentText(message);
  alert.showAndWait();
}

代码示例来源:origin: org.tentackle/tentackle-fx

/**
 * Shows an info dialog.
 *
 * @param message the message
 */
public void showInfoDialog(String message) {
 Alert alert = new Alert(Alert.AlertType.INFORMATION);
 alert.setTitle(FxFxBundle.getString("INFORMATION"));
 setAlertMessage(alert, message);
 alert.showAndWait();
}

代码示例来源:origin: it.unibo.alchemist/alchemist-projectview

private void setAlert(final String title, final String header, final String content) {
  final Alert alert = new Alert(AlertType.WARNING);
  alert.setTitle(title);
  alert.setHeaderText(header);
  alert.setContentText(content);
  alert.showAndWait();
}

代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine

public static void showInformation(String title, String message) {
 final Alert alert = new Alert(Alert.AlertType.INFORMATION);
 alert.initStyle(StageStyle.UNDECORATED);
 alert.setTitle("Information");
 alert.setHeaderText(title);
 alert.setContentText(message);
 alert.showAndWait();
}

代码示例来源:origin: io.github.factoryfx/javafxDataEditing

private void deleteSelected(Window owner) {
  if (uniformDesign.isAskBeforeDelete()){
    Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
    alert.initOwner(owner);
    alert.setTitle(uniformDesign.getText(deleteConfirmationTitle));
    alert.setHeaderText(uniformDesign.getText(deleteConfirmationHeader));
    alert.setContentText(uniformDesign.getText(deleteConfirmationContent));
    Optional<ButtonType> result = alert.showAndWait();
    if (result.isPresent()){
      if (result.get() != ButtonType.OK){
        return;
      }
    }
  }
  final List<T> selectedItems = new ArrayList<>(tableView.getSelectionModel().getSelectedItems());
  selectedItems.forEach(t -> deleter.accept(t,referenceListAttribute));
}

代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine

public static void showError(String title, String message) {
 final Alert alert = new Alert(Alert.AlertType.ERROR);
 alert.initStyle(StageStyle.UTILITY);
 alert.setTitle("Error");
 alert.setHeaderText(title);
 alert.setContentText(message);
 alert.showAndWait();
}

代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine

public static void showWarning(String title, String message) {
 final Alert alert = new Alert(Alert.AlertType.WARNING);
 alert.initStyle(StageStyle.UTILITY);
 alert.setTitle("Warning");
 alert.setHeaderText(title);
 alert.setContentText(message);
 alert.showAndWait();
}

代码示例来源:origin: ssaring/sportstracker

@Override
public void showMessageDialog(final Window parent, final Alert.AlertType alertType, final String titleKey,
    final String messageKey, final Object... arguments) {
  final String message = fxResources.getString(messageKey, arguments);
  final Alert alert = new Alert(alertType, message);
  alert.initOwner(parent);
  alert.setTitle(fxResources.getString(titleKey));
  alert.setHeaderText(null);
  alert.showAndWait();
}

代码示例来源:origin: ssaring/sportstracker

@Override
public Optional<ButtonType> showConfirmationDialog(final Window parent, final String titleKey,
    final String messageKey, final ButtonType... buttonTypes) {
  final Alert alert = new Alert(Alert.AlertType.CONFIRMATION, fxResources.getString(messageKey));
  alert.initOwner(parent);
  alert.setTitle(fxResources.getString(titleKey));
  alert.setHeaderText(null);
  // add custom button types if specified
  if (buttonTypes.length > 0) {
    alert.getButtonTypes().setAll(buttonTypes);
  }
  return alert.showAndWait();
}

相关文章