本文整理汇总了Java中javafx.scene.control.ButtonBar.ButtonData.NO属性的典型用法代码示例。如果您正苦于以下问题:Java ButtonData.NO属性的具体用法?Java ButtonData.NO怎么用?Java ButtonData.NO使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javafx.scene.control.ButtonBar.ButtonData
的用法示例。
在下文中一共展示了ButtonData.NO属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: displayFirstRunAlert
void displayFirstRunAlert(){
Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
alert.setGraphic(new ImageView(ClassLoader.getSystemResource("images/common/cloud.png").toExternalForm()));
alert.setTitle("Hall of Fame cloud service");
alert.setHeaderText("Create or login to a Hall of Fame account");
alert.setContentText("Online account lets you sync the game state\nbetween devices and compare results\nto other players.\n\n");
alert.initOwner(mGameStage);
ButtonType buttonTypeOK = new ButtonType("Create/Login", ButtonData.OK_DONE);
ButtonType buttonTypeDontAsk = new ButtonType("Don't ask again", ButtonData.NO);
ButtonType buttonTypeLater = new ButtonType("Ask later", ButtonData.CANCEL_CLOSE);
alert.getButtonTypes().setAll(buttonTypeOK, buttonTypeDontAsk, buttonTypeLater);
Optional<ButtonType> result = alert.showAndWait();
if(result.isPresent()) {
if (result.get() == buttonTypeOK) {
prefs.putBoolean("hofAsked", true);
displayHallOfFame();
} else if (result.get() == buttonTypeDontAsk) {
prefs.putBoolean("hofAsked", true);
}
}
}
示例2: queryPasswordHelper
@Nullable
private char[] queryPasswordHelper(Supplier<PasswordResult> query, boolean requery) {
PasswordResult passwordResult;
if (this.cancelAll) {
passwordResult = PasswordResult.CANCEL;
} else if (!requery && this.rememberedPassword != null) {
passwordResult = new PasswordResult(ButtonType.YES, this.rememberedPassword, true);
} else {
passwordResult = PlatformHelper.runLater(query);
}
ButtonData dialogResultData = passwordResult.dialogResult().getButtonData();
if (dialogResultData == ButtonData.YES) {
this.cancelAll = false;
this.rememberedPassword = (passwordResult.rememberPassword() ? passwordResult.password() : null);
} else if (dialogResultData == ButtonData.NO) {
this.cancelAll = false;
this.rememberedPassword = null;
} else {
this.cancelAll = true;
this.rememberedPassword = null;
}
return passwordResult.password();
}
示例3: handleDeleteRequest
/**
* Performs checks when User asks for a Matrix to be removed
*
* @param name of matrix to be deleted
*/
public static boolean handleDeleteRequest(String name) {
// Need to check if there is a file of given name there. If not we just return false, so no
// delete occurs
if (MatrixIO.isMatrixSaved(name + ".matrix")) {
Alert alert = new Alert(AlertType.WARNING);
alert.setTitle("Warning : Delete");
alert.setHeaderText("Delete " + name);
alert
.setContentText(name
+ " is saved on your system. Do you wish to remove this? (This operation can't be undone)");
ButtonType yesButton = new ButtonType("Yes", ButtonData.YES);
ButtonType noButton = new ButtonType("No", ButtonData.NO);
alert.getButtonTypes().setAll(yesButton, noButton);
Optional<ButtonType> result = alert.showAndWait();
// Only return true if the user wants the stuff to be removed
if (result.get().getButtonData() == ButtonData.YES) {
return true;
}
return false;
}
return true;
}
示例4: showUpdates
/**
* Asks user if they wish to update Matrixonator, if it can find an update
*
* @param version - new version of program
* @return true if user wishes to continue, false otherwise
*/
public static boolean showUpdates(String version) {
Alert alert = new Alert(AlertType.INFORMATION);
alert.setTitle("Matrixonator - Update");
alert.setHeaderText("Update available");
alert.setContentText("Matrixonator Version " + version
+ " is ready to download. Do you wish to download?");
ButtonType yesButton = new ButtonType("Yes", ButtonData.YES);
ButtonType noButton = new ButtonType("No", ButtonData.NO);
alert.getButtonTypes().setAll(yesButton, noButton);
Optional<ButtonType> result = alert.showAndWait();
if (result.get().getButtonData() == ButtonData.YES) {
return true;
} else {
return false;
}
}
示例5: saveOpportunity
public boolean saveOpportunity() {
if (!saved) {
final Alert alert = new Alert(AlertType.CONFIRMATION);
alert.setTitle("Save Tournament");
alert.setHeaderText("Do you want to save the changes you made to the tournament?");
alert.setContentText("Your changes will be lost if you don't save them.");
final ButtonType dont = new ButtonType("Don't Save", ButtonData.NO);
final ButtonType save = new ButtonType("Save", ButtonData.YES);
final ButtonType cancel = new ButtonType("Cancel", ButtonData.CANCEL_CLOSE);
alert.getButtonTypes().setAll(dont, save, cancel);
switch (alert.showAndWait().get().getButtonData()) {
case NO:
return false;
case YES:
save(false);
return true;
case CANCEL_CLOSE:
return true;
}
}
return false;
}
示例6: showYesOrNoDialog
public static Optional<Pair<String, String>> showYesOrNoDialog(Stage stage, String title, String message,
Consumer<? super Pair<String, String>> consumer, Consumer<Dialog<Pair<String, String>>> dialogHandler) {
// Create the custom dialog.
Dialog<Pair<String, String>> dialog = new Dialog<>();
dialog.setTitle(title);
dialog.setHeaderText(message);
// Set the button types.
ButtonType yesBtn = new ButtonType("Yes", ButtonData.YES);
ButtonType noBtn = new ButtonType("No", ButtonData.NO);
dialog.getDialogPane().getButtonTypes().addAll(yesBtn, noBtn);
dialog.setResultConverter(dialogButton -> {
if (dialogButton == yesBtn) {
return new Pair<>("RESULT", "Y");
} else if (dialogButton == noBtn) {
return new Pair<>("RESULT", "N");
}
return null;
});
dialog.initOwner(stage);
if (dialogHandler != null)
dialogHandler.accept(dialog);
Optional<Pair<String, String>> result = dialog.showAndWait();
if (consumer != null)
result.ifPresent(consumer);
return result;
}
示例7: checkUnsavedChanges
private boolean checkUnsavedChanges() {
clearSelection();
if(editHistory.editStackSize() != savedEditStackSize) {
Alert alert = new Alert(AlertType.CONFIRMATION);
alert.initOwner(stage);
alert.initModality(Modality.WINDOW_MODAL);
alert.setTitle("Unsaved changes");
alert.setHeaderText("Unsaved changes");
alert.setContentText("There are unsaved changes, do you want to save them?");
ButtonType discard = new ButtonType("Discard", ButtonData.NO);
alert.getButtonTypes().add(discard);
Optional<ButtonType> result = alert.showAndWait();
if(result.isPresent()) {
if(result.get() == ButtonType.OK) {
saveCircuitsInternal();
if(saveFile == null) {
return true;
}
} else if(result.get() == ButtonType.CANCEL) {
return true;
}
}
}
return false;
}
示例8: getPasswordInputResult
PasswordResult getPasswordInputResult(ButtonType button) {
PasswordResult passwordResult = PasswordResult.CANCEL;
ButtonData dialogResultData = button.getButtonData();
if (dialogResultData == ButtonData.YES) {
passwordResult = new PasswordResult(button, this.controller.getPasswordInput().toCharArray(),
this.controller.getRememberPasswordOption());
} else if (dialogResultData == ButtonData.NO) {
passwordResult = new PasswordResult(button, null, this.controller.getRememberPasswordOption());
}
return passwordResult;
}
示例9: handle
@Override
public void handle(final WindowEvent event) {
final Alert alert = new Alert(AlertType.CONFIRMATION);
final ButtonType buttonTypeOne = new ButtonType("Yes", ButtonData.OK_DONE);
final ButtonType buttonTypeTwo = new ButtonType("No", ButtonData.NO);
final ButtonType buttonTypeCancel = new ButtonType("Cancel", ButtonData.CANCEL_CLOSE);
alert.getButtonTypes().setAll(buttonTypeCancel, buttonTypeTwo, buttonTypeOne);
alert.setTitle("Save changes?");
alert.setHeaderText("Save changes?");
final Optional<ButtonType> result = alert.showAndWait();
if (result.get() == buttonTypeOne) {
try {
final FileChooser fileChooser = new FileChooser();
final File file = SettingsManager.getInstance().getDataFile();
fileChooser.setInitialDirectory(file.getParentFile());
fileChooser.getExtensionFilters().addAll(
new FileChooser.ExtensionFilter("Dr.Booking Booking Data", Arrays.asList("*.xml")),
new FileChooser.ExtensionFilter("All Files", "*"));
fileChooser.setTitle("Select File");
fileChooser.setInitialFileName(file.getName());
final File file2 = fileChooser.showSaveDialog(((Stage) event.getSource()));
if (file2 != null) {
SettingsManager.getInstance().setDataFile(file2);
mainController.save(file);
}
} catch (final Exception e) {
logger.error(e.getLocalizedMessage(), e);
}
exit();
} else if (result.get() == buttonTypeTwo) {
exit();
} else {
// cancel shutdown
event.consume();
}
}