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

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

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

Alert.setResizable介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

Alert dialog = new Alert(Alert.AlertType.ERROR);
dialog.setHeaderText("Connection Failed");
dialog.setContentText(this.getException().getMessage());

//FIXME: Remove after release 8u40
dialog.setResizable(true);
dialog.getDialogPane().setPrefSize(480, 320);

dialog.showAndWait();

代码示例来源: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: stackoverflow.com

ButtonType queen = new ButtonType("Queen");
ButtonType rook = new ButtonType("Rook");
Alert a = new Alert(AlertType.NONE, "Promote pawn to:", queen, rook);
a.setTitle("Title");
a.setHeaderText("My header text");
a.setResizable(true);
a.setContentText("Content text");
a.showAndWait().ifPresent(response -> {
  if (response == queen) {
    // promote to queen...
  } else if (response == rook) {
    // promote to rook...
  }
});

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

/**
 * Workaround for the bug that messages are not completely displayed if text is wrapped.
 *
 * @param alert the alert dialog
 * @param message the text message
 */
protected void setAlertMessage(Alert alert, String message) {
 alert.setHeaderText(null);
 Label textLabel = new Label();    // replace with non-wrapping label!
 textLabel.setWrapText(false);
 textLabel.setText(message);
 alert.getDialogPane().setContent(textLabel);
 alert.setResizable(true);   // RT-38998
}

相关文章