本文整理匯總了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;
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
}
示例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;
}
示例6: onCancel
private void onCancel() {
selection = ButtonType.CANCEL;
dispose();
}
示例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;
}
示例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;
}