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


Java ButtonType.NO屬性代碼示例

本文整理匯總了Java中javafx.scene.control.ButtonType.NO屬性的典型用法代碼示例。如果您正苦於以下問題:Java ButtonType.NO屬性的具體用法?Java ButtonType.NO怎麽用?Java ButtonType.NO使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在javafx.scene.control.ButtonType的用法示例。


在下文中一共展示了ButtonType.NO屬性的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: actionDelete

@FXML
private void actionDelete(ActionEvent event) {
    if (!canDelete) {
        return;
    }
    EntityListEntry selectedItem = entityList.getSelectionModel().getSelectedItem();
    Entity entity = selectedItem.getEntity();

    if (entity.getId() == null) {
        // entity doesn't exist yet.
        entities.remove(selectedItem);
        return;
    }

    Alert alert = new Alert(Alert.AlertType.CONFIRMATION, "Delete " + entity.getId().toString() + " ?", ButtonType.YES, ButtonType.NO);
    alert.showAndWait();

    if (alert.getResult() == ButtonType.YES) {
        try {
            entity.getService().delete(entity);
            entities.remove(selectedItem);
        } catch (ServiceFailureException ex) {
            LOGGER.warn("Failed to delete entity.", ex);
        }
    }
}
 
開發者ID:hylkevds,項目名稱:SensorThingsManager,代碼行數:26,代碼來源:ControllerCollection.java

示例2: newFile

@FXML
public void newFile() {

    Alert closeConfirmation = new Alert(
            Alert.AlertType.CONFIRMATION,
            "Create a new station?",
            ButtonType.YES,
            ButtonType.NO
    );
    closeConfirmation.setHeaderText("New station");
    closeConfirmation.initModality(Modality.APPLICATION_MODAL);
    closeConfirmation.initOwner(root.getScene().getWindow());

    Optional<ButtonType> closeResponse = closeConfirmation.showAndWait();
    if (ButtonType.YES.equals(closeResponse.get())) {
        station = new Station();
        updateEditors();
        updateTitle();
    }
}
 
開發者ID:rumangerst,項目名稱:CSLMusicModStationCreator,代碼行數:20,代碼來源:MainWindow.java

示例3: shortcutDelete

private void shortcutDelete(int index, ObservableGanttTask obs) {
	if(index == -1 || obs == null) {
		index = getSelectionModel().getSelectedIndex();
		obs = getSelectionModel().getSelectedItem();
	}

	if(obs == null || index == 0)
		return;
	
	if(obs.getTask().size() > 0) {
		ButtonType type = FXDialog.binaryChoiceAlert("This will delete also all sub-tasks. Proceed?").showAndWait().get();
		if(type == ButtonType.NO)
			return;
	}
	
	removeTask(index);
}
 
開發者ID:vibridi,項目名稱:qgu,代碼行數:17,代碼來源:TaskTableView.java

示例4: onClickRestore

/**
 * Restores all settings to default. Some settings like {@link Property#DEVELOPMENT} and
 * {@link Property#SHOW_CHANGELOG} won't be reset, since the user can't change those anyways.
 */
@SuppressWarnings("static-method") // Can't be static because of FXML injection
@FXML
private void onClickRestore() {
	final Alert alert = new Alert(AlertType.CONFIRMATION, Client.lang.getString("sureYouWantToRestoreSettings"), ButtonType.YES, ButtonType.NO);
	alert.setTitle(Client.lang.getString("restoreSettingsToDefault"));
	Client.insertAlertOwner(alert);

	final Optional<ButtonType> result = alert.showAndWait();

	result.ifPresent(button -> {
		if (button == ButtonType.YES) {
			restoreApplicationSettings();
			LegacySettingsController.restoreLegacySettings();

			// Reapply theme, since it might have been changed
			Client.getInstance().applyTheme();
			// Assure the view that the displays the correct data.
			Client.getInstance().reloadViewIfLoaded(View.SETTINGS);
		}
	});
}
 
開發者ID:Bios-Marcel,項目名稱:ServerBrowser,代碼行數:25,代碼來源:SettingsController.java

示例5: binaryChoiceAlert

/**
 * Creates a YES/NO alert (buttons included).
 * @param header The alert header message
 * @param message The alert body message
 * @return An alert dialog with the Yes and No buttons.
 */
public static Alert binaryChoiceAlert(String header, String message) {
	Alert alert = new Alert(AlertType.CONFIRMATION);	
	alert.setTitle("Confirm action");
	alert.setHeaderText(header);
	alert.setContentText(message);
	
	ButtonType[] buttons = new ButtonType[] {
		ButtonType.YES,
		ButtonType.NO
	};
	
	alert.getButtonTypes().setAll(buttons);
	return alert;
}
 
開發者ID:vibridi,項目名稱:fxutils,代碼行數:20,代碼來源:FXDialog.java

示例6: createAlert

private static Alert createAlert(String titleKey, String messageKey, AlertType alertType) {
    String title = I18n.getString(titleKey);
    String message = I18n.getString(messageKey);

    ButtonType[] buttons = alertType == CONFIRMATION || alertType == WARNING ?
            new ButtonType[]{ButtonType.YES, ButtonType.NO} : new ButtonType[]{ButtonType.OK};

    Alert alert = new Alert(alertType, message, buttons);
    alert.setTitle(title);
    alert.setHeaderText(null);
    return alert;
}
 
開發者ID:yiding-he,項目名稱:redisfx,代碼行數:12,代碼來源:Alerts.java

示例7: confirm

/**
 * Confirm box with 'Yes' or 'No' as available options
 *
 * @param message message to be displayed
 * @return true for yes, false for no.
 */
public static boolean confirm(String message)
{
    Alert alert = new Alert(Alert.AlertType.CONFIRMATION, message, ButtonType.YES, ButtonType.NO);
    alert.showAndWait();
    return alert.getResult().equals(ButtonType.YES);
}
 
開發者ID:Alienturnedhuman,項目名稱:PearPlanner,代碼行數:12,代碼來源:UIManager.java

示例8: shutdown

private void shutdown(Stage mainWindow) {
    // you could also use your logout window / whatever here instead
    Alert alert = new Alert(Alert.AlertType.NONE, "Exit Kanphnia2?", ButtonType.YES, ButtonType.NO);
    alert.setTitle("Confirm Exit");
    if (alert.showAndWait().orElse(ButtonType.NO) == ButtonType.YES) {
        // you may need to close other windows or replace this with Platform.exit();
        mainWindow.close();
    }
}
 
開發者ID:yc45,項目名稱:kanphnia2,代碼行數:9,代碼來源:MainApp.java

示例9: deleteSelectedFavourites

private void deleteSelectedFavourites() {
	final Alert alert = new Alert(AlertType.CONFIRMATION, Client.lang.getString("sureYouWantToDeleteFavourites"), ButtonType.YES, ButtonType.NO);
	Client.insertAlertOwner(alert);
	alert.setTitle(Client.lang.getString("deleteFavourites"));
	final Optional<ButtonType> result = alert.showAndWait();

	result.ifPresent(buttonType -> {
		if (buttonType == ButtonType.YES) {
			final List<SampServer> serverList = getSelectionModel().getSelectedItems();
			serverList.forEach(FavouritesController::removeServerFromFavourites);
			servers.removeAll(serverList);
		}
	});
}
 
開發者ID:Bios-Marcel,項目名稱:ServerBrowser,代碼行數:14,代碼來源:SampServerTable.java

示例10: show

/**
 * Shows the alert
 * @return <code>true</code> if "Yes" was pressed, else return false
 */
public boolean show(){
    alert = new Alert(Alert.AlertType.CONFIRMATION, question, ButtonType.YES, ButtonType.NO);
    alert.initStyle(style);
    Optional<ButtonType> result = alert.showAndWait();
    if (result.isPresent()) if (result.get() == ButtonType.YES) return true;
    return false;
}
 
開發者ID:cbrnrd,項目名稱:AlertFX,代碼行數:11,代碼來源:QuestionBox.java


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