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


Java ButtonData.OK_DONE属性代码示例

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


在下文中一共展示了ButtonData.OK_DONE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: onCmdDeleteEntry

@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,代码行数:22,代码来源:StoreController.java

示例3: setupButtons

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,代码行数:18,代码来源:LoginDialog.java

示例4: deleteBoard

/**
 * Deletes the board named {@boardName}
 *
 * @param boardName name of the board to delete
 */
public final void deleteBoard(String boardName) {
    Alert dlg = new Alert(AlertType.CONFIRMATION, "");
    dlg.initModality(Modality.APPLICATION_MODAL);
    dlg.setTitle("Confirmation");
    dlg.getDialogPane().setHeaderText("Delete board '" + boardName + "'?");
    dlg.getDialogPane().setContentText("Are you sure you want to delete this board?");
    Optional<ButtonType> response = dlg.showAndWait();

    if (response.isPresent() && response.get().getButtonData() == ButtonData.OK_DONE) {
        prefs.removeBoard(boardName);
        if (prefs.getLastOpenBoard().isPresent() &&
                prefs.getLastOpenBoard().get().equals(boardName)) {

            prefs.clearLastOpenBoard();
            prefs.clearLastOpenBoardPanelInfos();
        }
        ui.triggerEvent(new BoardSavedEvent());
        logger.info(boardName + " was deleted");
        ui.updateTitle();
    } else {
        logger.info(boardName + " was not deleted");
    }
}
 
开发者ID:HubTurbo,项目名称:HubTurbo,代码行数:28,代码来源:MenuControl.java

示例5: SettingsDialog

public SettingsDialog(final StateContainer state, final PersistenceHandler persistenceHandler) {
	this.persistenceHandler = persistenceHandler;
	this.state = state;

	setTitle("Skadi settings");
	setHeaderText(null);
	setGraphic(null);

	final ButtonType saveButtonType = new ButtonType("Save", ButtonData.OK_DONE);
	getDialogPane().getButtonTypes().addAll(saveButtonType, ButtonType.CANCEL);

	getDialogPane().setContent(getContentPane());

	setResultConverter(btn -> {
		if (btn == saveButtonType) {
			state.setExecutableStreamlink(tfStreamlink.getText());
			state.setExecutableChrome(tfChrome.getText());

			state.setDisplayNotifications(cbShowNotifications.isSelected());
			state.setMinimizeToTray(cbMinimizeToTray.isSelected());
			state.setUseDarkTheme(cbDarkTheme.isSelected());
			return state;
		}
		return null;
	});
}
 
开发者ID:JanStrauss,项目名称:skadi,代码行数:26,代码来源:SettingsDialog.java

示例6: MapSelectorDialog

public MapSelectorDialog(String title) {
	super();
	// Create the custom dialog.
	this.setTitle(title);

	// Set the button types.
	ButtonType addButtonType = new ButtonType("Select map", ButtonData.OK_DONE);
	this.getDialogPane().getButtonTypes().addAll(addButtonType, ButtonType.CANCEL);

	// Create the username and password labels and fields.
	VBox inputPane = new VBox();

	ComboBox<String> maps = new ComboBox<>();
	
	maps.getItems().addAll(MapListLoader.loadMapList());
	
	inputPane.getChildren().addAll(new Label("Select a map"), maps);


	this.getDialogPane().setContent(inputPane);

	this.setResultConverter(dialogButton -> {
		try {
			if (dialogButton == addButtonType) {
				return maps.getSelectionModel().getSelectedItem();
			}
		} catch (NumberFormatException e) {
			return null;
		}
		return null;
	});

}
 
开发者ID:ScreachFr,项目名称:titanium,代码行数:33,代码来源:MapSelectorDialog.java

示例7: PasswordDialog

public PasswordDialog(String whatFor) {
  setTitle(whatFor+" Password");
  setHeaderText("Please enter your "+whatFor+" password: ");

  ButtonType passwordButtonType = new ButtonType("Login", ButtonData.OK_DONE);
  getDialogPane().getButtonTypes().addAll(passwordButtonType, ButtonType.CANCEL);

  passwordField = new PasswordField();
  passwordField.setPromptText(whatFor+" password");

  HBox hBox = new HBox();
  hBox.getChildren().add(passwordField);
  hBox.setPadding(new Insets(20));

  HBox.setHgrow(passwordField, Priority.ALWAYS);

  getDialogPane().setContent(hBox);

  Platform.runLater(() -> passwordField.requestFocus());

  setResultConverter(dialogButton -> {
    if (dialogButton == passwordButtonType) {
      return passwordField.getText();
    }
    return "";
  });
}
 
开发者ID:billwi,项目名称:CyberTigerScoreboard,代码行数:27,代码来源:PasswordDialog.java

示例8: showDailySectionChooserDialog

public static final DailySectionModel showDailySectionChooserDialog() {
       LoggerFacade.INSTANCE.debug(DialogProvider.class, "Show DailySection chooser dialog"); // NOI18N
       LoggerFacade.INSTANCE.trace(DialogProvider.class, "TODO add size to the dialog"); // NOI18N
       LoggerFacade.INSTANCE.trace(DialogProvider.class, "TODO use properties"); // NOI18N
       
       final Dialog<DailySectionModel> dialog = new Dialog<>();
       dialog.setTitle("Daily Section Chooser"); // NOI18N
       dialog.setHeaderText("Select the Daily Section to which the Project should be added!"); // NOI18N
       dialog.setResizable(false);
       
       final DailySectionChooserDialogView view = new DailySectionChooserDialogView();
       dialog.getDialogPane().setContent(view.getView());
       
       final ButtonType buttonTypeOk = new ButtonType("Okay", ButtonData.OK_DONE); // NOI18N
       final ButtonType buttonTypeCancel = new ButtonType("Cancel", ButtonData.CANCEL_CLOSE); // NOI18N
dialog.getDialogPane().getButtonTypes().addAll(buttonTypeOk, buttonTypeCancel);
       
dialog.setResultConverter((ButtonType buttonType) -> {
           if (
                   buttonType != null
                   && buttonType.equals(buttonTypeOk)
           ) {
               return view.getRealPresenter().getDailySection();
           }
           
           return null;
       });
       
       final Optional<DailySectionModel> result = dialog.showAndWait();
       if (!result.isPresent()) {
           return null;
       }
       
       return result.get();
   }
 
开发者ID:Naoghuman,项目名称:Incubator,代码行数:35,代码来源:DialogProvider.java

示例9: showDeleteProjectDialog

public static final void showDeleteProjectDialog(long idToDelete, String projectTitle) {
       LoggerFacade.INSTANCE.debug(DialogProvider.class, "Show delete Project dialog"); // NOI18N

       final Dialog<Boolean> dialog = new Dialog<>();
       dialog.setTitle("Delete " + projectTitle); // NOI18N
       dialog.setHeaderText("Do you really want to delete this project?"); // NOI18N
       dialog.setResizable(false);
       
       final ButtonType buttonTypeOk = new ButtonType("Okay", ButtonData.OK_DONE); // NOI18N
       final ButtonType buttonTypeCancel = new ButtonType("Cancel", ButtonData.CANCEL_CLOSE); // NOI18N
dialog.getDialogPane().getButtonTypes().addAll(buttonTypeOk, buttonTypeCancel);
       
       dialog.setResultConverter((ButtonType buttonType) -> {
           final boolean shouldProjectDelete = buttonType != null && buttonType.equals(buttonTypeOk);
           return shouldProjectDelete;
       });
       
       final Optional<Boolean> result = dialog.showAndWait();
       if (
               !result.isPresent()
               || !result.get()
       ) {
           return;
       }
       
       // Delete the project
       SqlFacade.INSTANCE.getProjectSqlProvider().delete(idToDelete);
       
       // Cleanup
       ActionFacade.INSTANCE.handle(INavigationOverviewConfiguration.ON_ACTION__UPDATE_PROJECTS);
   }
 
开发者ID:Naoghuman,项目名称:Incubator,代码行数:31,代码来源:DialogProvider.java

示例10: showNewDailySectionDialog

public static final DailySectionModel showNewDailySectionDialog() {
       LoggerFacade.INSTANCE.debug(DialogProvider.class, "Show new DailySection dialog"); // NOI18N
       LoggerFacade.INSTANCE.trace(DialogProvider.class, "TODO add size to the dialog"); // NOI18N
       LoggerFacade.INSTANCE.trace(DialogProvider.class, "TODO use properties"); // NOI18N
       
       final Dialog<DailySectionModel> dialog = new Dialog<>();
       dialog.setTitle("New Daily Section"); // NOI18N
       dialog.setHeaderText("Creates a new Daily Section."); // NOI18N
       dialog.setResizable(false);
       
       final DailySectionDialogView view = new DailySectionDialogView();
       dialog.getDialogPane().setContent(view.getView());
       
       final ButtonType buttonTypeOk = new ButtonType("Create", ButtonData.OK_DONE); // NOI18N
       final ButtonType buttonTypeCancel = new ButtonType("Cancel", ButtonData.CANCEL_CLOSE); // NOI18N
dialog.getDialogPane().getButtonTypes().addAll(buttonTypeOk, buttonTypeCancel);
       
dialog.setResultConverter((ButtonType buttonType) -> {
           if (
                   buttonType != null
                   && buttonType.equals(buttonTypeOk)
           ) {
               return view.getRealPresenter().getDailySection();
           }
           
           return null;
       });
       
       final Optional<DailySectionModel> result = dialog.showAndWait();
       if (!result.isPresent()) {
           return null;
       }
       
       return result.get();
   }
 
开发者ID:Naoghuman,项目名称:Incubator,代码行数:35,代码来源:DialogProvider.java

示例11: showDialog

/**
 * Show dialog
 *
 * @param selectedText
 * @return
 */
private String showDialog(String selectedText) {
    Dialog dialog = new Dialog();
    dialog.setTitle("Edit Hex");
    dialog.setResizable(false);
    TextField text1 = new TextField();
    text1.addEventFilter(KeyEvent.KEY_TYPED, hex_Validation(2));
    text1.setText(selectedText);
    StackPane dialogPane = new StackPane();
    dialogPane.setPrefSize(150, 50);
    dialogPane.getChildren().add(text1);
    dialog.getDialogPane().setContent(dialogPane);
    ButtonType buttonTypeOk = new ButtonType("Save", ButtonData.OK_DONE);
    dialog.getDialogPane().getButtonTypes().add(buttonTypeOk);
    dialog.setResultConverter(new Callback<ButtonType, String>() {
        @Override
        public String call(ButtonType b) {
            
            if (b == buttonTypeOk) {
                switch (text1.getText().length()) {
                    case 0:
                        return null;
                    case 1:
                        return "0".concat(text1.getText());
                    default:
                        return text1.getText();
                }
            }
            return null;
        }
    });
    
    Optional<String> result = dialog.showAndWait();
    if (result.isPresent()) {
        return result.get();
    }
    return null;
}
 
开发者ID:exalt-tech,项目名称:trex-stateless-gui,代码行数:43,代码来源:PacketHex.java

示例12: 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

示例13: acceptCallDialog

public void acceptCallDialog(final Client client) {
    // set current client
    Core.instance().main().showUser(client);
    Core.instance().main().selectVideoCall();

    // create the custom dialog.
    Dialog<Boolean> dialog = new Dialog<>();
    dialog.setTitle("Incoming Call!");
    dialog.setHeaderText(userName.getText());
    dialog.setContentText(userName.getText() + " is calling...\n"
            + "Do you want to accept this call?");

    // set the icon 
    dialog.setGraphic(new ImageView(userPhoto.getImage()));

    // set the button types.
    ButtonType acceptButton = new ButtonType("Accept", ButtonData.OK_DONE);
    ButtonType declineButton = new ButtonType("Decline", ButtonData.CANCEL_CLOSE);
    dialog.getDialogPane().getButtonTypes().addAll(acceptButton, declineButton);

    // define result converter 
    dialog.setResultConverter(dialogButton -> {
        return dialogButton == acceptButton;
    });

    // return the result
    Optional<Boolean> result = dialog.showAndWait();
    if (result.isPresent() && result.get()) {
        Core.instance().dialer().acceptResponse(client, null);
    } else {
        Core.instance().dialer().acceptResponse(client, new Exception("Call was rejected"));
    }
}
 
开发者ID:dipu-bd,项目名称:Tuntuni,代码行数:33,代码来源:VideoCallController.java

示例14: handAbout

@FXML
private void handAbout() {
	String buttonText = I18n.getMessage(ViMixerBundles.UI, "about.alert.button.ok");
	ButtonType customerButton = new ButtonType(buttonText, ButtonData.OK_DONE);//overrider its default button
	String version = new Versions().get();
	String alertContent = I18n.getMessage(ViMixerBundles.UI, "about.alert.content", version, "Dailey Dai",
			"http://openthinks.com");
	Alert alert = new Alert(AlertType.INFORMATION, alertContent, customerButton);
	alert.setTitle(getBundleMessage("app.title"));
	alert.setHeaderText(getBundleMessage("about.alert.header"));
	alert.initOwner(this.stage());
	alert.showAndWait();
}
 
开发者ID:daileyet,项目名称:ViMixer,代码行数:13,代码来源:RootLayoutController.java

示例15: showEntrada

public static String showEntrada(String mensagem, String valorPadrao){
    TextInputDialog entrada = new TextInputDialog(valorPadrao);
    entrada.setTitle(idioma.getMensagem("informe_dados"));
    entrada.setHeaderText(null);
    entrada.setContentText(mensagem);
    ButtonType ok = new ButtonType(idioma.getMensagem("ok"), ButtonData.OK_DONE);
    ButtonType cancelar = new ButtonType(idioma.getMensagem("cancelar"), ButtonData.CANCEL_CLOSE);
    entrada.getDialogPane().getButtonTypes().setAll(ok, cancelar);
    Optional<String> result = entrada.showAndWait();
    if(result.isPresent()){
        return result.get();
    }else{
        return null;
    }
}
 
开发者ID:badernageral,项目名称:bgfinancas,代码行数:15,代码来源:Janela.java


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