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


Java Alert.getResult方法代碼示例

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


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

示例1: actionDelete

import javafx.scene.control.Alert; //導入方法依賴的package包/類
@FXML
private void actionDelete(ActionEvent event) {
    if (!canDelete) {
        return;
    }
    EntityListEntry selectedItem = entityList.getSelectionModel().getSelectedItem();
    Entity entity = selectedItem.getEntity();

    if (entity.getId() == null) {
        // entity doesn't exist yet.
        entities.remove(selectedItem);
        return;
    }

    Alert alert = new Alert(Alert.AlertType.CONFIRMATION, "Delete " + entity.getId().toString() + " ?", ButtonType.YES, ButtonType.NO);
    alert.showAndWait();

    if (alert.getResult() == ButtonType.YES) {
        try {
            entity.getService().delete(entity);
            entities.remove(selectedItem);
        } catch (ServiceFailureException ex) {
            LOGGER.warn("Failed to delete entity.", ex);
        }
    }
}
 
開發者ID:hylkevds,項目名稱:SensorThingsManager,代碼行數:27,代碼來源:ControllerCollection.java

示例2: onSubmitClicked

import javafx.scene.control.Alert; //導入方法依賴的package包/類
/**
 * Action button for when submit button is clicked.
 *
 * @throws IOException
 */
public void onSubmitClicked() throws IOException {
    if (!feedbackTextArea.getText().isEmpty()
            && !guestEmailTextField.getText().isEmpty()) {

        GuestFeedbackService guestfeedbackservice = new GuestFeedbackService();
        guestfeedbackservice.createNewGuestFeedback(
            new GuestFeedback(feedbackTextArea.getText(), guestEmailTextField.getText())
        );

        // Display an alert dialog to confirm the submission.
        Alert a = new Alert(AlertType.INFORMATION);
        a.setTitle("Thanks!");
        a.setHeaderText("Thanks for your feedback. As promised, we will now ignore it.");
        a.showAndWait();
        if (a.getResult() == ButtonType.OK) {
            // User clicked OK
            onCancelClicked(); // This just closes the dialog, but it's a bit hacky
        }
    }
}
 
開發者ID:maillouxc,項目名稱:git-rekt,代碼行數:26,代碼來源:LeaveFeedbackScreenController.java

示例3: askIfOk

import javafx.scene.control.Alert; //導入方法依賴的package包/類
public static boolean askIfOk(String msg) {
	Alert dialog = new Alert(AlertType.CONFIRMATION);
	dialog.setTitle("Confirmation");
	dialog.setResizable(true);
	dialog.setContentText(msg);
	dialog.setHeaderText(null);
	dialog.showAndWait();
	return dialog.getResult() == ButtonType.OK;
}
 
開發者ID:jesuino,項目名稱:java-ml-projects,代碼行數:10,代碼來源:AppUtils.java

示例4: showConfirmationMessage

import javafx.scene.control.Alert; //導入方法依賴的package包/類
public static ButtonType showConfirmationMessage(String confirmationMessage) {
    Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
    alert.setTitle("Planchester Message");
    alert.setHeaderText(confirmationMessage);
    alert.getButtonTypes().clear();
    alert.getButtonTypes().add(ButtonType.YES);
    alert.getButtonTypes().add(ButtonType.NO);
    alert.showAndWait();
    return alert.getResult();
}
 
開發者ID:ITB15-S4-GroupD,項目名稱:Planchester,代碼行數:11,代碼來源:MessageHelper.java

示例5: showPublishConfirmationMessage

import javafx.scene.control.Alert; //導入方法依賴的package包/類
public static ButtonType showPublishConfirmationMessage(String confirmationMessage) {
    Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
    alert.setTitle("Planchester Message");
    alert.setHeaderText(confirmationMessage);
    alert.getButtonTypes().clear();
    alert.getButtonTypes().add(new ButtonType("Cancel"));
    alert.getButtonTypes().add(new ButtonType("Publish"));
    alert.showAndWait();
    return alert.getResult();
}
 
開發者ID:ITB15-S4-GroupD,項目名稱:Planchester,代碼行數:11,代碼來源:MessageHelper.java

示例6: showLogoutUserMessage

import javafx.scene.control.Alert; //導入方法依賴的package包/類
public static ButtonType showLogoutUserMessage() {
    Alert alert = new Alert(Alert.AlertType.NONE);
    alert.setTitle("Planchester Logout");
    alert.setHeaderText("Are you sure that you want to log out and close Planchester?");
    alert.getButtonTypes().clear();
    alert.getButtonTypes().add(new ButtonType("Switch User"));
    alert.getButtonTypes().add(new ButtonType("Logout & Close"));
    alert.getButtonTypes().add(new ButtonType("Cancel"));
    alert.showAndWait();
    return alert.getResult();
}
 
開發者ID:ITB15-S4-GroupD,項目名稱:Planchester,代碼行數:12,代碼來源:MessageHelper.java


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