当前位置: 首页>>代码示例>>Java>>正文


Java ButtonData类代码示例

本文整理汇总了Java中javafx.scene.control.ButtonBar.ButtonData的典型用法代码示例。如果您正苦于以下问题:Java ButtonData类的具体用法?Java ButtonData怎么用?Java ButtonData使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ButtonData类属于javafx.scene.control.ButtonBar包,在下文中一共展示了ButtonData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: displayDeleteGameAlert

import javafx.scene.control.ButtonBar.ButtonData; //导入依赖的package包/类
public static void displayDeleteGameAlert() {
    int index = -1;

    Alert alert = new Alert(AlertType.CONFIRMATION);
    alert.setHeaderText(null);
    alert.setContentText("Are you sure you want to delete the selected games?");

    ButtonType deleteGame = new ButtonType("Delete Game(s)");
    ButtonType buttonTypeCancel = new ButtonType("Cancel", ButtonData.CANCEL_CLOSE);

    alert.getButtonTypes().setAll(deleteGame, buttonTypeCancel);

    Optional<ButtonType> result = alert.showAndWait();
    if (result.get() == deleteGame){
        for (String g : selectedGamesString) {
            index = getGameIndex(g);
            gameList.getGameList().remove(index);
        }

        refreshGameList();
        deleteButton.setDisable(true);
    }
    else {
        // ... user chose CANCEL or closed the dialog
    }
}
 
开发者ID:Stevoisiak,项目名称:Virtual-Game-Shelf,代码行数:27,代码来源:GameShelf.java

示例2: displayFirstRunAlert

import javafx.scene.control.ButtonBar.ButtonData; //导入依赖的package包/类
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,代码行数:26,代码来源:Utils.java

示例3: saveOnExit

import javafx.scene.control.ButtonBar.ButtonData; //导入依赖的package包/类
public void saveOnExit() {
    if (!taNoteText.getText().equals(this.note.getText())) {
        if (!JGMRConfig.getInstance().isDontAskMeToSave()) {
            Alert alert = new Alert(AlertType.CONFIRMATION);
            alert.setTitle("Save notes?");
            alert.setHeaderText("Would you like to save your notes?");
            ButtonType save = new ButtonType("Save");
            ButtonType dontaskmeagain = new ButtonType("Don't ask me again");
            ButtonType dontsave = new ButtonType("Don't save", ButtonData.CANCEL_CLOSE);
            alert.getButtonTypes().setAll(save, dontaskmeagain, dontsave);
            Optional<ButtonType> result = alert.showAndWait();
            if(result.get() == save){
                save();
            }else if(result.get() == dontaskmeagain){
                JGMRConfig.getInstance().setDontAskMeToSave(true);
                save();
            }
            
        } else {
            save();
        }
    }
}
 
开发者ID:eternia16,项目名称:javaGMR,代码行数:24,代码来源:TexteditorController.java

示例4: deleteInterview

import javafx.scene.control.ButtonBar.ButtonData; //导入依赖的package包/类
public void deleteInterview(DescriptionEntretien interview){
	Alert alert = new Alert(AlertType.CONFIRMATION);
	alert.setTitle("Supression Entretien");
	alert.setHeaderText("Vous allez supprimer "+interview.getNom());
	
	ButtonType buttonTypeOne = new ButtonType("Valider");
	ButtonType buttonTypeCancel = new ButtonType("Annuler", ButtonData.CANCEL_CLOSE);

	alert.getButtonTypes().setAll(buttonTypeOne, buttonTypeCancel);

	Optional<ButtonType> result = alert.showAndWait();
	if (result.get() == buttonTypeOne){
		main.getCurrentProject().getEntretiens().remove(interview);
		this.getTreeItem().getParent().getChildren().remove(this.getTreeItem());
	}
}
 
开发者ID:coco35700,项目名称:uPMT,代码行数:17,代码来源:InterviewTreeView.java

示例5: FileSelection

import javafx.scene.control.ButtonBar.ButtonData; //导入依赖的package包/类
public FileSelection(File parent) {
	DialogPane dialogPane = this.getDialogPane();
	dialogPane.setMaxWidth(1.7976931348623157E308D);
	this.directoryView = new CheckTreeView<>();
	this.directoryView.setMaxWidth(1.7976931348623157E308D);
	CheckBoxTreeItem<File> root = createTree(new CheckBoxTreeItem<>(parent));
	root.setExpanded(true);
	directoryView.setRoot(root);
	GridPane.setHgrow(this.directoryView, Priority.ALWAYS);
	GridPane.setFillWidth(this.directoryView, true);
	this.grid = new GridPane();
	this.grid.setHgap(10.0D);
	this.grid.setMaxWidth(1.7976931348623157E308D);
	this.grid.setAlignment(Pos.CENTER_LEFT);
	dialogPane.contentTextProperty().addListener((o) -> this.updateGrid());
	this.setTitle(ControlResources.getString("Dialog.confirm.title"));
	dialogPane.setHeaderText(ControlResources.getString("Dialog.confirm.header"));
	dialogPane.getStyleClass().add("text-input-dialog");
	dialogPane.getButtonTypes().addAll(new ButtonType[] { ButtonType.APPLY, ButtonType.CANCEL });
	this.updateGrid();
	this.setResultConverter((dialogButton) -> {
		ButtonBar.ButtonData data = dialogButton == null ? null : dialogButton.getButtonData();
		return data == ButtonData.APPLY ? this.getValues() : null;
	});
}
 
开发者ID:HearthProject,项目名称:OneClient,代码行数:26,代码来源:FileSelection.java

示例6: displayIndex

import javafx.scene.control.ButtonBar.ButtonData; //导入依赖的package包/类
private void displayIndex(Map<String, Double> resultIndex, String title, String header) {
    BaseDialog dialog = new BaseDialog(title, header);
    dialog.getDialogPane().setPrefSize(800, 600);
    dialog.getDialogPane().getButtonTypes().addAll(new ButtonType(Configuration.getBundle().getString("ui.actions.stats.close"), ButtonBar.ButtonData.CANCEL_CLOSE));

    // draw
    final CategoryAxis xAxis = new CategoryAxis();
    final NumberAxis yAxis = new NumberAxis();
    final LineChart<String,Number> lineChart = new LineChart<>(xAxis, yAxis);
    lineChart.setTitle(title);
    lineChart.setLegendVisible(false);

    xAxis.setLabel(Configuration.getBundle().getString("ui.actions.stats.xaxis"));
    yAxis.setLabel(Configuration.getBundle().getString("ui.actions.readable.yaxis"));

    XYChart.Series<String, Number> series = new XYChart.Series();
    for(Map.Entry<String, Double> st:resultIndex.entrySet()) {
        series.getData().add(new XYChart.Data(st.getKey(), st.getValue()));
    }
    lineChart.getData().addAll(series);
    dialog.getDialogPane().setContent(lineChart);
    dialog.setResizable(true);
    dialog.showAndWait();
}
 
开发者ID:firm1,项目名称:zest-writer,代码行数:25,代码来源:MenuController.java

示例7: showPopup

import javafx.scene.control.ButtonBar.ButtonData; //导入依赖的package包/类
public static void showPopup()
{
    Alert alert = new Alert(AlertType.INFORMATION);
    alert.setTitle("Information");
    alert.setHeaderText(
            Translation.LANG.getTranslation("alert.forge.reinstall.header") + Gui.mineIdeInfo.getForgeVersion());
    alert.setContentText(Translation.LANG.getTranslation("alert.forge.reinstall.content.line1") + "\n"
            + Translation.LANG.getTranslation("alert.forge.reinstall.content.line2"));

    ButtonType buttonForceUpdate = new ButtonType(Translation.LANG.getTranslation("button.forceUpdate"));
    ButtonType buttonCancel = new ButtonType(Translation.LANG.getTranslation("button.cancel"),
            ButtonData.CANCEL_CLOSE);

    alert.getButtonTypes().setAll(buttonForceUpdate, buttonCancel);

    Optional<ButtonType> result = alert.showAndWait();
    if (result.get() == buttonForceUpdate)
        ForgeWorkspace.getInstance().forceUpdate();
    else
    {
    }
}
 
开发者ID:Leviathan-Studio,项目名称:MineIDE-UI,代码行数:23,代码来源:PopupForgeInstallation.java

示例8: queryPasswordHelper

import javafx.scene.control.ButtonBar.ButtonData; //导入依赖的package包/类
@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,代码行数:27,代码来源:PasswordDialog.java

示例9: onCmdDeleteEntry

import javafx.scene.control.ButtonBar.ButtonData; //导入依赖的package包/类
@SuppressWarnings("unused")
@FXML
void onCmdDeleteEntry(ActionEvent evt) {
	UserCertStoreEntry entry = getSelectedStoreEntry();

	if (entry != null) {
		Optional<ButtonType> confirmation = Alerts
				.message(AlertType.CONFIRMATION, StoreI18N.formatSTR_MESSAGE_CONFIRM_DELETE(entry)).showAndWait();

		if (confirmation.isPresent() && confirmation.get().getButtonData() == ButtonData.OK_DONE) {
			try {
				this.storeProperty.get().deleteEntry(entry.id());
				if (entry.equals(getSelectedStoreEntry())) {
					this.ctlStoreEntryView.getSelectionModel().clearSelection();
				}
			} catch (IOException e) {
				Alerts.unexpected(e).showAndWait();
			}
		}
		updateStoreEntryView();
	}
}
 
开发者ID:hdecarne,项目名称:certmgr,代码行数:23,代码来源:StoreController.java

示例10: handleCloseApp

import javafx.scene.control.ButtonBar.ButtonData; //导入依赖的package包/类
/**
 * Handler to close the application.
 *
 * @param event The event.
 */
@FXML
protected void handleCloseApp(ActionEvent event) {
    Alert closeDialog = new Alert(Alert.AlertType.CONFIRMATION);
    closeDialog.setTitle(I18n.getMsg("gui.confirm-exit"));
    closeDialog.setContentText(I18n.getMsg("gui.want-to-quit"));
    ButtonType confirm = new ButtonType(I18n.getMsg("gui.exit"));
    ButtonType cancel = new ButtonType(I18n.getMsg("gui.cancel"),
            ButtonData.CANCEL_CLOSE);
    closeDialog.getButtonTypes().setAll(confirm, cancel);
    Optional<ButtonType> res = closeDialog.showAndWait();
    if (res.isPresent() && res.get() == confirm) {
        Stage stage = (Stage) buttonClose.getScene().getWindow();
        stage.fireEvent(new WindowEvent(
                stage,
                WindowEvent.WINDOW_CLOSE_REQUEST
        ));
    }
}
 
开发者ID:gdi-by,项目名称:downloadclient,代码行数:24,代码来源:Controller.java

示例11: setupButtons

import javafx.scene.control.ButtonBar.ButtonData; //导入依赖的package包/类
private Node setupButtons(Map<TextFieldDescription, TextField> fields) {
		ButtonType loginButtonType = new ButtonType("Login", ButtonData.OK_DONE);
		getDialog().getDialogPane().getButtonTypes().addAll(loginButtonType, ButtonType.CANCEL);

		// Enable/Disable login button depending on whether a username was entered.
		Node loginButton = getDialog().getDialogPane().lookupButton(loginButtonType);
//		loginButton.setDisable(true);
		
		// Convert the result to a username-password-pair when the login button is clicked.
		getDialog().setResultConverter(dialogButton -> {
		    if (dialogButton == loginButtonType) {
		    	return DialogResult.newInstance(fields);
		    }
		    return null;
		});
		
		return loginButton;
	}
 
开发者ID:lucastanziano,项目名称:JavaFX-Skeleton-DEPRECATED,代码行数:19,代码来源:LoginDialog.java

示例12: NBTVersionChooser

import javafx.scene.control.ButtonBar.ButtonData; //导入依赖的package包/类
public NBTVersionChooser() {
	setTitle(translate("nbt_version_chooser.title"));
	setHeaderText(translate("nbt_version_chooser.header"));
	boxInputVersion = new ComboBox<>(FXCollections.observableArrayList(NBTVersion.values()));
	boxOutputVersion = new ComboBox<>(FXCollections.observableArrayList(NBTVersion.values()));
	GridPane grid = new GridPane();
	grid.add(new Label(translate("nbt_version_chooser.input_version")), 1, 1);
	grid.add(boxInputVersion, 2, 1);
	grid.add(new Label(translate("nbt_version_chooser.output_version")), 1, 2);
	grid.add(boxOutputVersion, 2, 2);
	getDialogPane().setContent(grid);
	getDialogPane().getButtonTypes().add(ButtonType.OK);
	getDialogPane().getButtonTypes().add(ButtonType.CANCEL);
	setResultConverter(button -> {
		if (button.getButtonData() == ButtonData.OK_DONE) {
			return new NBTVersionConfig(boxInputVersion.getValue(), boxOutputVersion.getValue());
		} else {
			return null;
		}
	});

	boxInputVersion.setValue(NBTVersion.defaultConfig.getInputVersion());
	boxOutputVersion.setValue(NBTVersion.defaultConfig.getOutputVersion());
}
 
开发者ID:to2mbn,项目名称:maptranslator,代码行数:25,代码来源:NBTVersionChooser.java

示例13: setupDialog

import javafx.scene.control.ButtonBar.ButtonData; //导入依赖的package包/类
private void setupDialog(Menu... menus) {
	this.setTitle("Hotkeys");
	this.getDialogPane().getStylesheets().add(getClass().getResource(STYLE).toString());
	this.initOwner(parent.getScene().getWindow());
	this.initModality(Modality.NONE);
	this.getDialogPane().setPrefWidth(WIDTH);
	setupContentGrid();
	this.setHeaderText("Hotkeys");
	setupContent(menus);

	getDialogPane().setContent(content);
	
	ButtonType close = new ButtonType("Close", ButtonData.CANCEL_CLOSE);
	this.getDialogPane().getButtonTypes().add(close);
	this.showingProperty().addListener((obj, oldV, newV) -> {
		MenuItem hotkey = menus[menus.length - 1].getItems().get(0);
		hotkey.setDisable(!hotkey.isDisable());
	});
}
 
开发者ID:ProgrammingLife2015,项目名称:dnainator,代码行数:20,代码来源:HotkeyHelpDialog.java

示例14: setupDialog

import javafx.scene.control.ButtonBar.ButtonData; //导入依赖的package包/类
private void setupDialog() {
	this.setTitle("About DNAinator");
	this.setResizable(true);
	this.getDialogPane().getStylesheets().add(getClass().getResource(STYLE).toString());
	this.initOwner(parent.getScene().getWindow());
	
	ImageView img = new ImageView();
	img.setImage(new Image(getClass().getResourceAsStream(LOGO)));
	this.setGraphic(img);
	readProperties();
	
	this.setHeaderText("DNAinator\nDNA network visualization tool");
	this.setContentText(contentText());
	
	ButtonType close = new ButtonType("Close", ButtonData.CANCEL_CLOSE);
	this.getDialogPane().getButtonTypes().add(close);
}
 
开发者ID:ProgrammingLife2015,项目名称:dnainator,代码行数:18,代码来源:AboutDialog.java

示例15: CheckUnsaved

import javafx.scene.control.ButtonBar.ButtonData; //导入依赖的package包/类
private boolean CheckUnsaved()
{
	if (!_isUnsaved) return false;

	Alert alert = new Alert(AlertType.CONFIRMATION);
	ButtonType buttonYes = new ButtonType(LocalizationHandler.Get("Yes"));
	ButtonType buttonNo = new ButtonType(LocalizationHandler.Get("No"));
	ButtonType buttonCancel = new ButtonType(LocalizationHandler.Get("Cancel"), ButtonData.CANCEL_CLOSE);
	alert.setTitle(CommonExtensions.TitleAndVersionString(getClass()));
	alert.setHeaderText(LocalizationHandler.Get("NotSaved"));
	alert.setContentText(String.format(LocalizationHandler.Get("SaveChangesPrompt"), txtName.getText()));
	alert.getButtonTypes().setAll(buttonYes, buttonNo, buttonCancel);

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

	ButtonType b = result.get();
	if (b == buttonYes)
	{
		Save();
	}

	return b == buttonCancel;
}
 
开发者ID:andrewsarnold,项目名称:FlagMaker-2,代码行数:24,代码来源:MainWindowController.java


注:本文中的javafx.scene.control.ButtonBar.ButtonData类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。