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


Java ButtonType.CANCEL屬性代碼示例

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


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

示例1: closeEditor

private boolean closeEditor(IEditor e) {
    if (e == null) {
        return true;
    }
    if (e.isDirty()) {
        Optional<ButtonType> result = FXUIUtils.showConfirmDialog(DisplayWindow.this,
                "File \"" + e.getName() + "\" Modified. Do you want to save the changes ",
                "File \"" + e.getName() + "\" Modified", AlertType.CONFIRMATION, ButtonType.YES, ButtonType.NO,
                ButtonType.CANCEL);
        ButtonType shouldSaveFile = result.get();
        if (shouldSaveFile == ButtonType.CANCEL) {
            return false;
        }
        if (shouldSaveFile == ButtonType.YES) {
            File file = save(e);
            if (file == null) {
                return false;
            }
            EditorDockable dockable = (EditorDockable) e.getData("dockable");
            dockable.updateKey();
        }
    }
    return true;
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:24,代碼來源:DisplayWindow.java

示例2: createGroup

public static Group createGroup(GroupType type, Path path, String name) {
    List<Group> groups = getGroups(type);
    for (Group g : groups) {
        if (g.getName().equals(name)) {
            Optional<ButtonType> option = FXUIUtils.showConfirmDialog(null,
                    type.fileType() + " `" + g.getName() + "` name is already used.", "Duplicate " + type.fileType() + " Name",
                    AlertType.CONFIRMATION);
            if (!option.isPresent() || option.get() == ButtonType.CANCEL) {
                return null;
            }
        }
    }
    Group group = new Group(name);
    try {
        Files.write(path, (type.fileCommentHeader() + group.toJSONString()).getBytes());
        return new Group(path.toFile());
    } catch (IOException e) {
        return null;
    }
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:20,代碼來源:Group.java

示例3: onClickPageClose

@FXML
private void onClickPageClose(ActionEvent event) {
    if (this.rootTagElement == null) {
        return;
    }
    final Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
    alert.setTitle("Saving?");
    alert.setContentText("Do you want to save your latest changes?");
    alert.getButtonTypes().clear();
    alert.getButtonTypes().addAll(ButtonType.YES, ButtonType.NO, ButtonType.CANCEL);

    final ButtonType result = alert.showAndWait().orElse(ButtonType.CANCEL);
    if (result == ButtonType.YES) {
        save();
    }
    if (result != ButtonType.CANCEL) {
        this.tags_view.setRoot(null);
        this.file_save.setDisable(true);
        this.rootTagElement = null;
        this.openFile = null;
    }
}
 
開發者ID:LanternPowered,項目名稱:LanternNBT,代碼行數:22,代碼來源:NbtEditor.java

示例4: delete

private void delete(ObservableList<TreeItem<Resource>> selectedItems) {
    Optional<ButtonType> option = Optional.empty();
    ArrayList<TreeItem<Resource>> items = new ArrayList<>(selectedItems);
    for (TreeItem<Resource> treeItem : items) {
        option = treeItem.getValue().delete(option);
        if (option.isPresent() && option.get() == ButtonType.CANCEL) {
            break;
        }
    }
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:10,代碼來源:ResourceView.java

示例5: saveAs

@Override public File saveAs(String script, Window parent, String filename) throws IOException {
    boolean saved = false;
    while (!saved) {
        File file = askForFile(parent, filename);
        if (file == null) {
            return null;
        }
        ButtonType option = ButtonType.YES;
        if (file.exists()) {
            if (nameValidateChecker != null && !nameValidateChecker.okToOverwrite(file)) {
                return null;
            }
            Optional<ButtonType> result = FXUIUtils.showConfirmDialog(parent,
                    "File " + file.getName() + " already exists. Do you want to overwrite?", "File exists",
                    AlertType.CONFIRMATION, ButtonType.YES, ButtonType.NO);
            option = result.get();
        }
        if (option == ButtonType.YES) {
            setCurrentFile(file);
            saveToFile(currentFile, script);
            return file;
        }
        if (option == ButtonType.CANCEL) {
            return null;
        }
    }
    return null;
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:28,代碼來源:FileHandler.java

示例6: onCancel

private void onCancel() {
    selection = ButtonType.CANCEL;
    dispose();
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:4,代碼來源:Blurb.java

示例7: deletionConfirmation

public static boolean deletionConfirmation(Shipment s) {
	Alert confirmModal = new Alert(Alert.AlertType.WARNING, "" + s, ButtonType.OK, ButtonType.CANCEL);
	confirmModal.setHeaderText("Êtes-vous sûr de vouloir supprimer cet envoi ?");
	Optional<ButtonType> result = confirmModal.showAndWait();
	return result.isPresent() && result.get() == ButtonType.OK;
}
 
開發者ID:teamOtee,項目名稱:x-facteur,代碼行數:6,代碼來源:ShipmentController.java

示例8: deletionConfirmation

public static boolean deletionConfirmation(Mailman m) {
	Alert confirmModal = new Alert(Alert.AlertType.WARNING, "" + m, ButtonType.OK, ButtonType.CANCEL);
	confirmModal.setHeaderText("Êtes-vous sûr de vouloir supprimer ce facteur ?");
	Optional<ButtonType> result = confirmModal.showAndWait();
	return result.isPresent() && result.get() == ButtonType.OK;
}
 
開發者ID:teamOtee,項目名稱:x-facteur,代碼行數:6,代碼來源:MailmanController.java


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