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


Java ButtonData.NO屬性代碼示例

本文整理匯總了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);
        }
    }

}
 
開發者ID:nwg-piotr,項目名稱:EistReturns,代碼行數:25,代碼來源:Utils.java

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

示例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;
}
 
開發者ID:Sheepzez,項目名稱:Matrixonator-Java,代碼行數:30,代碼來源:MatrixAlerts.java

示例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;
  }
}
 
開發者ID:Sheepzez,項目名稱:Matrixonator-Java,代碼行數:25,代碼來源:MatrixAlerts.java

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

示例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;

}
 
開發者ID:callakrsos,項目名稱:Gargoyle,代碼行數:35,代碼來源:DialogUtil.java

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

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

示例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();
    }
}
 
開發者ID:DrBookings,項目名稱:drbookings,代碼行數:39,代碼來源:DrBookingsApplication.java


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