Java Code Examples for javafx.scene.control.ButtonBar.ButtonData#YES

The following examples show how to use javafx.scene.control.ButtonBar.ButtonData#YES . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DownloadDialog.java    From Animu-Downloaderu with MIT License 6 votes vote down vote up
public DownloadDialog(int count) {
	var buttonType = new ButtonType("Yes", ButtonData.YES);
	var dialogPane = getDialogPane();
	setTitle("Confirm Download");
	dialogPane.getStylesheets().add(getClass().getResource("/css/combo.css").toExternalForm());

	String question;
	if (count == 0) {
		question = "Please select at least one video";
		dialogPane.getButtonTypes().addAll(ButtonType.CLOSE);
	} else {
		question = String.format("Do you want to download %d episode(s)?", count);
		dialogPane.getButtonTypes().addAll(buttonType, ButtonType.NO);
	}

	var label = new Label(question);
	dialogPane.setContent(label);
	setResultConverter(dialogButton -> dialogButton == buttonType);
}
 
Example 2
Source File: FXMLTimingController.java    From pikatimer with GNU General Public License v3.0 6 votes vote down vote up
public void clearAllOverrides(ActionEvent fxevent){
    //TODO: Prompt and then remove all times associated with that timing location 
    // _or_ all timing locations
    Alert alert = new Alert(AlertType.CONFIRMATION);
    alert.setTitle("Clear Overrides...");
    alert.setHeaderText("Delete Overrides:");
    alert.setContentText("Do you want to delete all overrides?");

    //ButtonType allButtonType = new ButtonType("All");
    
    ButtonType deleteButtonType = new ButtonType("Delete",ButtonData.YES);
    ButtonType cancelButtonType = new ButtonType("Cancel", ButtonData.CANCEL_CLOSE);

    alert.getButtonTypes().setAll(cancelButtonType, deleteButtonType );

    Optional<ButtonType> result = alert.showAndWait();
    if (result.get() == deleteButtonType) {
        // delete all
        timingDAO.clearAllOverrides(); 
    }
 
}
 
Example 3
Source File: DonateDialog.java    From Animu-Downloaderu with MIT License 5 votes vote down vote up
public DonateDialog() {
	var buttonType = new ButtonType("Yes", ButtonData.YES);
	var dialogPane = getDialogPane();

	setTitle("Donate :3");
	dialogPane.getStylesheets().add(getClass().getResource("/css/combo.css").toExternalForm());

	var gridPane = new GridPane();

	gridPane.setVgap(10);
	String question = "Thank you for clicking the donate button!! <3\n\n"
			+ "You can donate via liberapay, paypal, or help me by subscribing to my patreon!\n\n";

	Label librapay = new Label("Liberapay");
	Label paypal = new Label("Paypal");
	Label patrion = new Label("Patreon");
	HBox donateButtons = new HBox(15);
	donateButtons.setAlignment(Pos.CENTER);
	librapay.setCursor(Cursor.HAND);
	paypal.setCursor(Cursor.HAND);
	patrion.setCursor(Cursor.HAND);
	librapay.setId("link");
	paypal.setId("link");
	patrion.setId("link");

	librapay.setOnMouseClicked(e -> handleClick("https://liberapay.com/codingotaku/donate"));
	paypal.setOnMouseClicked(e -> handleClick("https://paypal.me/codingotaku"));
	patrion.setOnMouseClicked(e -> handleClick("https://www.patreon.com/bePatron?u=13678963"));
	donateButtons.getChildren().addAll(librapay, paypal, patrion);

	dialogPane.getButtonTypes().addAll(ButtonType.CLOSE);

	var label = new Label(question);
	GridPane.setConstraints(label, 1, 2);
	GridPane.setConstraints(donateButtons, 1, 3, 2, 1);
	gridPane.getChildren().addAll(label, donateButtons);
	dialogPane.setContent(gridPane);
	setResultConverter(dialogButton -> dialogButton == buttonType);
}
 
Example 4
Source File: FXMLTimingController.java    From pikatimer with GNU General Public License v3.0 5 votes vote down vote up
public void clearAllTimes(ActionEvent fxevent){
    //TODO: Prompt and then remove all times associated with that timing location 
    // _or_ all timing locations
    Alert alert = new Alert(AlertType.CONFIRMATION);
    alert.setTitle("Clear Timing Data...");
    alert.setHeaderText("Clear Timing Data:");
    alert.setContentText("Do you want to clear the times for all locations or just the " + selectedTimingLocation.getLocationName()+ " location?");

    ButtonType allButtonType = new ButtonType("All Times");
    
    ButtonType currentButtonType = new ButtonType(selectedTimingLocation.getLocationName() + " Times",ButtonData.YES);
    ButtonType cancelButtonType = new ButtonType("Cancel", ButtonData.CANCEL_CLOSE);

    alert.getButtonTypes().setAll(cancelButtonType, allButtonType,  currentButtonType );

    Optional<ButtonType> result = alert.showAndWait();
    if (result.get() == allButtonType){
        // ... user chose All
        timingDAO.clearAllTimes();
        // itterate over all of the timing locations
        timingLocationList.stream().forEach(tl -> {tl.getInputs().stream().forEach(tli -> {tli.clearLocalReads();});});
    } else if (result.get() == currentButtonType) {
        // ... user chose "Two"
        selectedTimingLocation.getInputs().stream().forEach(tli -> {tli.clearReads();});
    } else {
        // ... user chose CANCEL or closed the dialog
    }
 
}