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


Java Alert.initModality方法代碼示例

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


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

示例1: showDialog

import javafx.scene.control.Alert; //導入方法依賴的package包/類
public void showDialog() {
    FXMLLoader loader = new FXMLLoader(getClass().getResource("/gui/diff/diff-view.fxml"));
    try {
        loader.setController(diffController);
        DialogPane root = loader.load();
        root.getStylesheets().add(getClass().getResource("/gui/diff/diff-view.css").toExternalForm());

        Alert alert = new Alert(Alert.AlertType.WARNING);
        alert.setTitle("Diff Viewer");
        alert.setResizable(true);
        alert.setDialogPane(root);
        alert.initModality(Modality.WINDOW_MODAL);

        Window window = alert.getDialogPane().getScene().getWindow();
        window.setOnCloseRequest(event -> window.hide());

        alert.showAndWait();

    } catch (IOException e) {
        e.printStackTrace();
    }
}
 
開發者ID:adr,項目名稱:eadlsync,代碼行數:23,代碼來源:DiffView.java

示例2: showDialog

import javafx.scene.control.Alert; //導入方法依賴的package包/類
public boolean showDialog() {
    FXMLLoader loader = new FXMLLoader(getClass().getResource("/gui/conflict/resolve-conflicts-view.fxml"));
    try {
        loader.setController(conflictManagerController);
        DialogPane root = loader.load();
        root.getStylesheets().add(getClass().getResource("/gui/conflict/resolve-conflicts-view.css").toExternalForm());

        Alert alert = new Alert(Alert.AlertType.WARNING);
        alert.setTitle("Resolve conflicts");
        alert.setResizable(true);
        alert.setDialogPane(root);
        alert.initModality(Modality.WINDOW_MODAL);

        Window window = alert.getDialogPane().getScene().getWindow();
        window.setOnCloseRequest(event -> window.hide());

        alert.showAndWait();

    } catch (IOException e) {
        e.printStackTrace();
    }
    return conflictManagerController.isFinishedSuccessfully();
}
 
開發者ID:adr,項目名稱:eadlsync,代碼行數:24,代碼來源:ConflictManagerView.java

示例3: _showMessageDialog

import javafx.scene.control.Alert; //導入方法依賴的package包/類
public static void _showMessageDialog(Window parent, String message, String title, AlertType type, boolean monospace) {
    Alert alert = new Alert(type);
    alert.initOwner(parent);
    alert.setTitle(title);
    alert.setHeaderText(title);
    alert.setContentText(message);
    alert.initModality(Modality.APPLICATION_MODAL);
    alert.setResizable(true);
    if (monospace) {
        Text text = new Text(message);
        alert.getDialogPane().setStyle("-fx-padding: 0 10px 0 10px;");
        text.setStyle(" -fx-font-family: monospace;");
        alert.getDialogPane().contentProperty().set(text);
    }
    alert.showAndWait();
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:17,代碼來源:FXUIUtils.java

示例4: newFile

import javafx.scene.control.Alert; //導入方法依賴的package包/類
@FXML
public void newFile() {

    Alert closeConfirmation = new Alert(
            Alert.AlertType.CONFIRMATION,
            "Create a new station?",
            ButtonType.YES,
            ButtonType.NO
    );
    closeConfirmation.setHeaderText("New station");
    closeConfirmation.initModality(Modality.APPLICATION_MODAL);
    closeConfirmation.initOwner(root.getScene().getWindow());

    Optional<ButtonType> closeResponse = closeConfirmation.showAndWait();
    if (ButtonType.YES.equals(closeResponse.get())) {
        station = new Station();
        updateEditors();
        updateTitle();
    }
}
 
開發者ID:rumangerst,項目名稱:CSLMusicModStationCreator,代碼行數:21,代碼來源:MainWindow.java

示例5: showPropertyContainerEditor

import javafx.scene.control.Alert; //導入方法依賴的package包/類
public static void showPropertyContainerEditor(Window owner, KlcPropertyContainer propertyContainer, String title,
		String headerText, String contentText) {

	Alert alert = new Alert(AlertType.CONFIRMATION, contentText, ButtonType.OK);
	alert.setTitle(title);
	alert.setHeaderText(headerText);
	alert.initOwner(owner);
	alert.initModality(Modality.WINDOW_MODAL);

	KlcPropertyContainerEditor editor = new KlcPropertyContainerEditor();
	editor.setPrefWidth(300);
	editor.setPrefHeight(200);
	editor.setPropertyContainer(propertyContainer);
	alert.getDialogPane().setContent(editor);

	alert.showAndWait();

}
 
開發者ID:enoy19,項目名稱:keyboard-light-composer,代碼行數:19,代碼來源:DialogUtil.java

示例6: showThrowable

import javafx.scene.control.Alert; //導入方法依賴的package包/類
/** Show error dialog. **/
static void showThrowable(Window parent, Throwable e) {
	Main.log(e);
	Alert alert = new Alert(Alert.AlertType.ERROR);
	alert.setTitle("Exception");
	alert.initOwner(parent);
	alert.initModality(Modality.WINDOW_MODAL);
	alert.setHeaderText(e.getClass().getName());
	alert.setContentText(e.getMessage());
	StringWriter stringWriter = new StringWriter();
	PrintWriter printWriter = new PrintWriter(stringWriter);
	e.printStackTrace(printWriter);
	String exceptionText = stringWriter.toString();
	TextArea textArea = new TextArea(exceptionText);
	textArea.setEditable(false);
	textArea.setWrapText(true);
	textArea.setMaxWidth(Double.MAX_VALUE);
	textArea.setMaxHeight(Double.MAX_VALUE);
	alert.getDialogPane().setExpandableContent(textArea);
	alert.showAndWait();
}
 
開發者ID:DeskChan,項目名稱:DeskChan,代碼行數:22,代碼來源:App.java

示例7: _showConfirmDialog

import javafx.scene.control.Alert; //導入方法依賴的package包/類
public static Optional<ButtonType> _showConfirmDialog(Window parent, String message, String title, AlertType type,
        ButtonType... buttonTypes) {
    Alert alert = new Alert(type, message, buttonTypes);
    alert.initOwner(parent);
    alert.setTitle(title);
    alert.initModality(Modality.APPLICATION_MODAL);
    return alert.showAndWait();
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:9,代碼來源:FXUIUtils.java

示例8: getAlert

import javafx.scene.control.Alert; //導入方法依賴的package包/類
public static Alert getAlert(String header, String content, AlertType alertType, Modality modality, Window window,
		StageStyle style) {
	Alert alert = new Alert(alertType);

	alert.setTitle(Values.MAIN_TITLE);
	alert.setHeaderText(header);
	alert.setContentText(content);

	alert.initModality(modality);
	alert.initOwner(window);
	alert.initStyle(style);

	return alert;
}
 
開發者ID:zhazhapan,項目名稱:qiniu,代碼行數:15,代碼來源:Dialogs.java

示例9: dialog

import javafx.scene.control.Alert; //導入方法依賴的package包/類
public static Alert dialog(Stage stage, String header, String content) {
    Alert alert = new Alert(Alert.AlertType.WARNING);
    alert.initOwner(stage);
    alert.initModality(Modality.WINDOW_MODAL);
    alert.setHeaderText(header);
    alert.setContentText(content);
    return alert;
}
 
開發者ID:pingcai,項目名稱:maven-package-gui-installer,代碼行數:9,代碼來源:ComponentUtils.java


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