當前位置: 首頁>>代碼示例>>Java>>正文


Java Alert.AlertType方法代碼示例

本文整理匯總了Java中javafx.scene.control.Alert.AlertType方法的典型用法代碼示例。如果您正苦於以下問題:Java Alert.AlertType方法的具體用法?Java Alert.AlertType怎麽用?Java Alert.AlertType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javafx.scene.control.Alert的用法示例。


在下文中一共展示了Alert.AlertType方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: SquidMessageDialog

import javafx.scene.control.Alert; //導入方法依賴的package包/類
private SquidMessageDialog(Alert.AlertType alertType, String message, String headerText, Window owner) {
    super(alertType);
    initOwner(owner);
    setTitle("Squid3 Alert");
    setContentText(message);
    setHeaderText(headerText);
    initStyle(StageStyle.DECORATED);
    getDialogPane().setPrefSize(500, 350);

}
 
開發者ID:CIRDLES,項目名稱:Squid,代碼行數:11,代碼來源:SquidMessageDialog.java

示例2: viewInfo

import javafx.scene.control.Alert; //導入方法依賴的package包/類
@Override
public void viewInfo(String name, String header, String content, Alert.AlertType type) {
    a.setAlertType(type);
    a.setTitle(name);
    a.setHeaderText(header);
    a.setContentText(content);
    a.showAndWait();
}
 
開發者ID:Obsidiam,項目名稱:amelia,代碼行數:9,代碼來源:AlertController.java

示例3: printAlert

import javafx.scene.control.Alert; //導入方法依賴的package包/類
private void printAlert(Alert.AlertType type){
    Alert alert = new Alert(type);
    alert.setTitle("Warning Dialog");
    alert.setHeaderText("Look, a Warning Dialog");
    alert.setContentText("Careful with the next step!");
    alert.showAndWait();
}
 
開發者ID:tillind,項目名稱:pandemie,代碼行數:8,代碼來源:IndexController.java

示例4: showDialog

import javafx.scene.control.Alert; //導入方法依賴的package包/類
private static void showDialog(Alert.AlertType type, String title, String header, String content) {
    Alert alert = new Alert(type);
    alert.setTitle(title);
    alert.setHeaderText(header);
    alert.setContentText(content);
    alert.showAndWait();
}
 
開發者ID:dbisUnibas,項目名稱:ReqMan,代碼行數:8,代碼來源:Utils.java

示例5: confirm

import javafx.scene.control.Alert; //導入方法依賴的package包/類
public static ButtonType confirm(Alert.AlertType alertType, String title, String message, ButtonType... buttonTypes) {
    Alert alert = new Alert(alertType, message, buttonTypes);
    alert.setTitle(title);
    alert.setHeaderText(null);

    Stage stage = (Stage) alert.getDialogPane().getScene().getWindow();
    Icons.Logo.setToStage(stage);

    return alert.showAndWait().orElse(ButtonType.CANCEL);
}
 
開發者ID:yiding-he,項目名稱:redisfx,代碼行數:11,代碼來源:Fx.java

示例6: createAlert

import javafx.scene.control.Alert; //導入方法依賴的package包/類
/**
 * Create an alert with a given type, title, desciption, content text and expandable content.
 *
 * @param type The type of the alert
 * @param title The title of the alert
 * @param description The description in the alert
 * @param contentText The content text for the alert
 * @param expandableContent The expandable content in the alert. This parameter may be null
 * @return The created alert
 */
public static Alert createAlert(Alert.AlertType type, String title, String description,
    String contentText, String expandableContent) {
  Alert alert = new Alert(type);
  alert.setTitle(title);
  alert.setHeaderText(description);
  alert.setContentText(contentText);

  TextArea textArea = new TextArea(expandableContent);
  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);
  
  if (expandableContent != null && expandableContent.length() > 0) {
    GridPane expContent = new GridPane();
    expContent.setMaxWidth(Double.MAX_VALUE);
    if (type.equals(Alert.AlertType.ERROR)) {
      Label label = new Label("Stack trace:");
      expContent.add(label, 0, 0);
    }
    expContent.add(textArea, 0, 1);
    alert.getDialogPane().setExpandableContent(expContent);
  }

  if (type.equals(Alert.AlertType.ERROR) && expandableContent != null) {
    System.err.println(contentText);
    System.err.println(expandableContent);
  }

  alert.getDialogPane().setId("AlertDialogPane_" + type.toString());

  return alert;
}
 
開發者ID:VerifAPS,項目名稱:stvs,代碼行數:47,代碼來源:AlertFactory.java

示例7: showMessage

import javafx.scene.control.Alert; //導入方法依賴的package包/類
private static Optional showMessage(String title, String headerText, String contentText, Alert.AlertType type, ImageView icon, List<ButtonType> buttonTypeList, Pane pane) {
    GraphicsDevice graphicsDevice = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();

    pane.setDisable(true);

    Alert alert = new Alert(type);
    alert.setTitle(title);
    alert.getDialogPane().setMaxHeight(graphicsDevice.getDisplayMode().getHeight() * 0.9);
    alert.getDialogPane().setMaxWidth(graphicsDevice.getDisplayMode().getWidth() * 0.9);

    if(icon != null) {
        alert.setGraphic(icon);
    }

    alert.setHeaderText(headerText);

    Label contentTextElement = new Label(contentText);
    contentTextElement.setWrapText(true);
    ScrollPane contentTextElementScrollPane = new ScrollPane(contentTextElement);
    alert.getDialogPane().setContent(contentTextElementScrollPane);

    if(buttonTypeList != null) {
        alert.getButtonTypes().setAll(buttonTypeList);
    }

    Optional optional = alert.showAndWait();
    alert.close();

    pane.setDisable(false);

    return optional;
}
 
開發者ID:ITB15-S4-GroupD,項目名稱:Planchester,代碼行數:33,代碼來源:AlertHelper.java

示例8: displayAlert

import javafx.scene.control.Alert; //導入方法依賴的package包/類
/**
  * Displays and alert window if the there was an error updating books 
  * avaliable copies.
  * @param type type of alert to display
  * @param title the title of the alert window
  * @param messageHeader the message on the alert window
  * @param errorCode the error code to be displayed if multiple avaliable.
  */
private void displayAlert(Alert.AlertType type, String title, 
         String messageHeader, String errorCode) 
 {
     Alert alert = new Alert(type);
     alert.setTitle(title);
     alert.setContentText(messageHeader);
     alert.setHeaderText(null);
     Stage stage5 = (Stage) alert.getDialogPane().getScene().getWindow();
     stage5.getIcons().add(new Image("images/emptySpace.png"));
     alert.setGraphic(new ImageView(("images/emptySpace.png")));
     alert.showAndWait();
 }
 
開發者ID:pxndroid,項目名稱:mountieLibrary,代碼行數:21,代碼來源:Books.java

示例9: displayAlert

import javafx.scene.control.Alert; //導入方法依賴的package包/類
/**
  * Displays and alert window if the connection to the data base failed.
  * @param type Type of alert to be displayed.
  * @param title title of the alerts window.
  * @param messageHeader Message to be displayed on the alert window.
  * @param extraText extra text to display (optional)
  */
 private void displayAlert(Alert.AlertType type, String title, String messageHeader, 
         String extraText) 
 {
     Alert alert = new Alert(type);
     
     //If database is not available 
         alert.setTitle(title);
         alert.setHeaderText(messageHeader);
         Stage stage = (Stage) alert.getDialogPane().getScene().getWindow();
         stage.getIcons().add(new Image("images/db.png"));
         alert.setGraphic(new ImageView(("images/db.png")));
         alert.showAndWait();
}
 
開發者ID:pxndroid,項目名稱:mountieLibrary,代碼行數:21,代碼來源:MountieQueries.java

示例10: msg

import javafx.scene.control.Alert; //導入方法依賴的package包/類
private void msg(String text, Alert.AlertType alertType) {
  Alert alert = new Alert(alertType);
  alert.setHeaderText("");
  alert.setContentText(text);
  alert.showAndWait();
}
 
開發者ID:RusZ,項目名稱:TextClassifier,代碼行數:7,代碼來源:MainWindow.java

示例11: AlertFatalErrorController

import javafx.scene.control.Alert; //導入方法依賴的package包/類
public AlertFatalErrorController(Alert.AlertType alertType, UIToolBox toolBox) {
    super(alertType, toolBox);
}
 
開發者ID:mbari-media-management,項目名稱:vars-annotation,代碼行數:4,代碼來源:AlertFatalErrorController.java

示例12: AlertErrorController

import javafx.scene.control.Alert; //導入方法依賴的package包/類
public AlertErrorController(Alert.AlertType alertType, UIToolBox toolBox) {
    this.alert = new Alert(alertType);
    this.toolBox = toolBox;
}
 
開發者ID:mbari-media-management,項目名稱:vars-annotation,代碼行數:5,代碼來源:AlertErrorController.java

示例13: Dialogue

import javafx.scene.control.Alert; //導入方法依賴的package包/類
/**
 * Creates an instance of {@link Dialogue}.
 *
 * @param title      the title of the {@link Alert}
 * @param headerText the header text of the {@link Alert}
 * @param alertType  the {@link Alert.AlertType} of the alert
 */
Dialogue(final String title, final String headerText, final Alert.AlertType alertType) {
    setAlert(new Alert(alertType), title, headerText);
}
 
開發者ID:ProgrammingLife2017,項目名稱:hygene,代碼行數:11,代碼來源:Dialogue.java

示例14: MsgBox

import javafx.scene.control.Alert; //導入方法依賴的package包/類
/**
 * Show a message box with context <code>msg</code>
 * and type <code>type</code>
 * @param msg The message to display
 * @param type The alert type of the MsgBox
 */
public MsgBox(String msg, Alert.AlertType type){
    this.msg = msg;
    this.type = type;
}
 
開發者ID:cbrnrd,項目名稱:AlertFX,代碼行數:11,代碼來源:MsgBox.java


注:本文中的javafx.scene.control.Alert.AlertType方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。