本文整理匯總了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);
}
示例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();
}
示例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();
}
示例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();
}
示例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);
}
示例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;
}
示例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;
}
示例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();
}
示例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();
}
示例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();
}
示例11: AlertFatalErrorController
import javafx.scene.control.Alert; //導入方法依賴的package包/類
public AlertFatalErrorController(Alert.AlertType alertType, UIToolBox toolBox) {
super(alertType, toolBox);
}
示例12: AlertErrorController
import javafx.scene.control.Alert; //導入方法依賴的package包/類
public AlertErrorController(Alert.AlertType alertType, UIToolBox toolBox) {
this.alert = new Alert(alertType);
this.toolBox = toolBox;
}
示例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);
}
示例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;
}