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


Java ButtonType.OK屬性代碼示例

本文整理匯總了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();
	}
}
 
開發者ID:krHasan,項目名稱:Money-Manager,代碼行數:16,代碼來源:SettingsController.java

示例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");
        }
    }
}
 
開發者ID:maillouxc,項目名稱:git-rekt,代碼行數:23,代碼來源:EditPricesDialogController.java

示例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();
	}
}
 
開發者ID:krHasan,項目名稱:Money-Manager,代碼行數:16,代碼來源:AboutController.java

示例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);
	}
}
 
開發者ID:yc45,項目名稱:kanphnia2,代碼行數:26,代碼來源:RootLayoutController.java

示例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);
	}
}
 
開發者ID:dhawal9035,項目名稱:WebPLP,代碼行數:22,代碼來源:Main.java

示例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;
	}
}
 
開發者ID:DeskChan,項目名稱:DeskChan,代碼行數:12,代碼來源:OverlayStage.java

示例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");
    }
}
 
開發者ID:kmrifat,項目名稱:Dr-Assistant,代碼行數:28,代碼來源:PatientsController.java

示例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);
    }
}
 
開發者ID:maillouxc,項目名稱:git-rekt,代碼行數:33,代碼來源:BookingDetailsScreenController.java

示例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;
}
 
開發者ID:leeks-and-dragons,項目名稱:dialog-tool,代碼行數:10,代碼來源:JavaFXUtils.java

示例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();
        }
    }
}
 
開發者ID:kmrifat,項目名稱:Dr-Assistant,代碼行數:14,代碼來源:TemplatesController.java

示例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);
}
 
開發者ID:zhazhapan,項目名稱:visual-spider,代碼行數:13,代碼來源:MainController.java

示例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);
    }
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:34,代碼來源:DisplayWindow.java

示例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;
}
 
開發者ID:eacp,項目名稱:Luna-Exam-Builder,代碼行數:9,代碼來源:Dialogs.java

示例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;
}
 
開發者ID:jesuino,項目名稱:java-ml-projects,代碼行數:9,代碼來源:AppUtils.java

示例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));
    }
}
 
開發者ID:mbari-media-management,項目名稱:vars-annotation,代碼行數:13,代碼來源:DeleteSelectedAnnotationsBC.java


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