本文整理匯總了Java中javafx.scene.control.ButtonType.OK屬性的典型用法代碼示例。如果您正苦於以下問題:Java ButtonType.OK屬性的具體用法?Java ButtonType.OK怎麽用?Java ButtonType.OK使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類javafx.scene.control.ButtonType
的用法示例。
在下文中一共展示了ButtonType.OK屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: mnuUndo
@FXML
private void mnuUndo(ActionEvent event) {
Stage SettingsStage = (Stage) btnSignOut.getScene().getWindow();
Alert alert = new Alert(AlertType.CONFIRMATION);
alert.setTitle("Action Failed");
alert.setHeaderText("Undo Function Works Only From \"Make A Transaction\" and \"History\" Window");
alert.setContentText("Press \"OK\" to go to \"Make A Transaction\" window");
alert.setX(SettingsStage.getX() + 60);
alert.setY(SettingsStage.getY() + 170);
Optional<ButtonType> result = alert.showAndWait();
if (result.get() == ButtonType.OK){
(new TabAccess()).setTabName("tabGetMoney"); //name of which Tab should open
(new GoToOperation()).goToMakeATransaction(SettingsStage.getX(), SettingsStage.getY());
SettingsStage.close();
}
}
示例2: onEditButtonClicked
public void onEditButtonClicked() {
boolean isGoodInput = true;
double d = 0;
try {
d = Double.valueOf(editPriceField.getText());
} catch (NumberFormatException e) {
isGoodInput = false;
}
if (isGoodInput == true) {
RoomService roomservice = new RoomService();
Alert a = new Alert(AlertType.CONFIRMATION);
a.setTitle("Price Change Confirmation");
a.setHeaderText("Confirm the Price Change?");
Optional<ButtonType> result = a.showAndWait();
if (result.get() == ButtonType.OK) {
roomservice.editRoomPrice(EditPricesScreenController.service, d);
Stage dialogStage = (Stage) cancelButton.getScene().getWindow();
dialogStage.close();
ScreenManager.getInstance().switchToScreen("/fxml/EditPricesScreen.fxml");
}
}
}
示例3: mnuUndo
@FXML
private void mnuUndo(ActionEvent event) {
Stage AboutStage = (Stage) btnSignOut.getScene().getWindow();
Alert alert = new Alert(AlertType.CONFIRMATION);
alert.setTitle("Action Failed");
alert.setHeaderText("Undo Function Works Only From \"Make A Transaction\" and \"History\" Window");
alert.setContentText("Press \"OK\" to go to \"Make A Transaction\" window");
alert.setX(AboutStage.getX() + 60);
alert.setY(AboutStage.getY() + 170);
Optional<ButtonType> result = alert.showAndWait();
if (result.get() == ButtonType.OK){
(new TabAccess()).setTabName("tabGetMoney"); //name of which Tab should open
(new GoToOperation()).goToMakeATransaction(AboutStage.getX(), AboutStage.getY());
AboutStage.close();
}
}
示例4: handleOpen
@FXML
private void handleOpen() {
Alert alert = new Alert(AlertType.CONFIRMATION);
alert.setTitle("Confirmation Dialog");
alert.setHeaderText("Do you want to save your current changes?");
alert.setContentText("");
Optional<ButtonType> result = alert.showAndWait();
if (result.get() == ButtonType.OK){
File entryFile = mainApp.getFilePath();
mainApp.saveEntryDataToFile(entryFile);
}
FileChooser fileChooser = new FileChooser();
// set extension filter
FileChooser.ExtensionFilter extFilter = new FileChooser.ExtensionFilter("XML files (*.xml)", "*.xml");
fileChooser.getExtensionFilters().add(extFilter);
// show open file dialog
File file = fileChooser.showOpenDialog(mainApp.getPrimaryStage());
if (file != null) {
mainApp.loadEntryDataFromFile(file);
}
}
示例5: setMainASMFile
@Override
public void setMainASMFile()
{
ASMFile activeFile = getActiveFile();
if (activeFile == null)
{
Dialogues.showActionFailedDialogue("No file is selected!");
return;
}
Project activeProject = activeFile.getProject();
String message = "The file \"" + activeFile.getName()
+ "\" will be used as the main file for the project \""
+ activeProject.getName() + "\"";
Optional<ButtonType> result = Dialogues.showConfirmationDialogue(message);
if (result.get() == ButtonType.OK)
{
int index = activeProject.indexOf(activeFile);
Collections.swap(activeProject, 0, index);
}
}
示例6: showConfirmation
private static void showConfirmation(String text){
Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
try {
((Stage) alert.getDialogPane().getScene().getWindow()).setAlwaysOnTop(true);
} catch (Exception e){ }
alert.setTitle(Main.getString("default_messagebox_name"));
alert.setContentText(Main.getString(text));
Optional<ButtonType> result = alert.showAndWait();
if(result.get() != ButtonType.OK){
return;
}
}
示例7: openDeleteDialog
private void openDeleteDialog(Patient patient) {
Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
alert.setTitle("Delete patient ?");
alert.setHeaderText("Are your sure ?");
alert.setContentText("It will delete all the releted document along to " + patient.getName());
Optional<ButtonType> result = alert.showAndWait();
if (result.get() == ButtonType.OK) {
patientPrescriptions = prescriptionGetway.patientPrescriptions(patient);
patientPrescriptions.forEach((Prescription prescription) -> {
prescriptionGetway.deletePrescription(prescription);
});
if (patientGetway.delete(patient.getId())) {
Alert nAlert = new Alert(Alert.AlertType.INFORMATION);
nAlert.setTitle("Success");
nAlert.setHeaderText("Patient has been deleted");
nAlert.setContentText("Patient Deleted");
nAlert.show();
if (patientDefault) {
loadPatients();
} else {
searchPatient(tfSearch.getText());
}
}
} else {
System.out.println("no");
}
}
示例8: onCancelBookingButtonClicked
/**
* Displays a confirmation dialog showing the price that will be charged as a cancellation fee.
*/
@FXML
private void onCancelBookingButtonClicked() {
double cancellationFee = BookingService.calcCancellationFee(this.booking);
String cancellationFeeString = String.format("$%.2f", cancellationFee);
// Show confirmation dialog
Alert confirmationDialog = new Alert(AlertType.CONFIRMATION);
confirmationDialog.setTitle("Confirm");
confirmationDialog.setHeaderText("Confirm Cancel Booking");
// Check for the case where there is no fee because of the 24 hr window
if(cancellationFee < 0.01) {
confirmationDialog.setContentText("You will not be assessed a cancellation fee."
+ " - please confirm that you want to cancel this booking."
+ " This action cannot be undone.");
} else {
confirmationDialog.setContentText("You will be assessed a cancellation fee of "
+ cancellationFeeString
+ " - please confirm that you want to cancel this booking. "
+ "This action cannot be undone.");
}
// Show the dialog and get the result
Optional<ButtonType> result = confirmationDialog.showAndWait();
if(result.get() == ButtonType.OK) {
// User chose OK
BookingService bookingService = new BookingService();
bookingService.cancelBooking(this.booking);
bookingCanceledLabel.setVisible(true);
}
}
示例9: showConfirmationDialog
public static boolean showConfirmationDialog (String title, String content) {
Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
alert.setTitle(title);
alert.setHeaderText(null);
alert.setContentText(content);
Optional<ButtonType> result = alert.showAndWait();
return result.get() == ButtonType.OK;
}
示例10: openDeleteDialog
private void openDeleteDialog(Template template) {
Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
alert.setTitle("Confirm");
alert.setHeaderText("Are you sure ?");
alert.setContentText("Are you sure, you want to delete " + template.getTemplateName());
Optional<ButtonType> result = alert.showAndWait();
if (result.get() == ButtonType.OK) {
if (templateGetway.deleteTemplate(template)) {
Alert alert1 = new Alert(Alert.AlertType.INFORMATION, "Template deleted");
alert1.showAndWait();
loadData();
}
}
}
示例11: exit
/**
* 退出程序
*/
public void exit() {
if (crawling) {
Optional<ButtonType> result = Alerts.showConfirmation(Values.MAIN_TITLE, Values.EXIT_CRAWLING);
if (result.get() != ButtonType.OK) {
return;
}
}
saveLog();
System.exit(0);
}
示例12: updated
@Override public void updated(IResourceActionSource source, Resource resource) {
if (resource.getFilePath() != null) {
File file = resource.getFilePath().toFile();
EditorDockable dockable = findEditorDockable(file);
if (dockable != null) {
IEditor editor = dockable.getEditor();
if (editor.isDirty() && !editor.isNewFile()) {
Optional<ButtonType> option = FXUIUtils.showConfirmDialog(DisplayWindow.this,
"File `" + file + "` has been modified outside the editor. Do you want to reload it?",
"File being modified", AlertType.CONFIRMATION);
if (option.isPresent() && option.get() == ButtonType.OK) {
Platform.runLater(() -> editor.refreshResource());
}
} else {
Platform.runLater(() -> editor.refreshResource());
}
}
}
if (source != navigatorPanel) {
navigatorPanel.updated(source, resource);
}
if (source != suitesPanel) {
suitesPanel.updated(source, resource);
}
if (source != featuresPanel) {
featuresPanel.updated(source, resource);
}
if (source != storiesPanel) {
storiesPanel.updated(source, resource);
}
if (source != issuesPanel) {
issuesPanel.updated(source, resource);
}
}
示例13: confirm
public static boolean confirm(String title,String header,String body){
Alert alert = new Alert(AlertType.CONFIRMATION);
alert.setTitle(title);
alert.setHeaderText(header);
alert.setContentText(body);
Optional<ButtonType> result = alert.showAndWait();
return result.get() == ButtonType.OK;
}
示例14: askIfOk
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;
}
示例15: apply
private void apply() {
ObservableList<Annotation> annotations = toolBox.getData().getSelectedAnnotations();
final int count = annotations.size();
ResourceBundle i18n = toolBox.getI18nBundle();
String content = i18n.getString("buttons.delete.dialog.content1") + " " +
count + " " + i18n.getString("buttons.delete.dialog.content2");
alert.setContentText(content);
Optional<ButtonType> buttonType = alert.showAndWait();
if (buttonType.get() == ButtonType.OK) {
toolBox.getEventBus()
.send(new DeleteAnnotationsCmd(annotations));
}
}