本文整理汇总了Java中javafx.scene.control.Dialog.setHeaderText方法的典型用法代码示例。如果您正苦于以下问题:Java Dialog.setHeaderText方法的具体用法?Java Dialog.setHeaderText怎么用?Java Dialog.setHeaderText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.Dialog
的用法示例。
在下文中一共展示了Dialog.setHeaderText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: show
import javafx.scene.control.Dialog; //导入方法依赖的package包/类
public void show() {
paneController.load();
ResourceBundle i18n = toolBox.getI18nBundle();
Dialog<ButtonType> dialog = new Dialog<>();
dialog.setTitle(i18n.getString("prefsdialog.title"));
dialog.setHeaderText(i18n.getString("prefsdialog.header"));
GlyphsFactory gf = MaterialIconFactory.get();
Text settingsIcon = gf.createIcon(MaterialIcon.SETTINGS, "30px");
dialog.setGraphic(settingsIcon);
dialog.getDialogPane()
.getButtonTypes()
.addAll(ButtonType.OK, ButtonType.CANCEL);
dialog.getDialogPane()
.setContent(paneController.getRoot());
dialog.getDialogPane()
.getStylesheets()
.addAll(toolBox.getStylesheets());
Optional<ButtonType> buttonType = dialog.showAndWait();
buttonType.ifPresent(bt -> {
if (bt == ButtonType.OK) {
paneController.save();
}
});
}
示例2: init
import javafx.scene.control.Dialog; //导入方法依赖的package包/类
protected void init() {
String tooltip = toolBox.getI18nBundle().getString("buttons.upon");
MaterialIconFactory iconFactory = MaterialIconFactory.get();
Text icon = iconFactory.createIcon(MaterialIcon.VERTICAL_ALIGN_BOTTOM, "30px");
Text icon2 = iconFactory.createIcon(MaterialIcon.VERTICAL_ALIGN_BOTTOM, "30px");
initializeButton(tooltip, icon);
ResourceBundle i18n = toolBox.getI18nBundle();
Dialog<String> dialog = dialogController.getDialog();
dialog.setTitle(i18n.getString("buttons.upon.dialog.title"));
dialog.setHeaderText(i18n.getString("buttons.upon.dialog.header"));
dialog.setContentText(i18n.getString("buttons.upon.dialog.content"));
dialog.setGraphic(icon2);
dialog.getDialogPane().getStylesheets().addAll(toolBox.getStylesheets());
}
示例3: showOptions
import javafx.scene.control.Dialog; //导入方法依赖的package包/类
@Override
public void showOptions() {
Dialog<String> dialog = new Dialog<>();
dialog.setTitle("Perception-Action Configuration");
dialog.setHeaderText("You can define next action in function of agent perception (up, left, right and down)");
dialog.getDialogPane().setPrefSize(500, 600);
FontIcon icon = new FontIcon(FontAwesome.COGS);
icon.setIconSize(64);
dialog.setGraphic(icon);
ButtonType applyChanges = new ButtonType("Apply", ButtonBar.ButtonData.OK_DONE);
dialog.getDialogPane().getButtonTypes().addAll(applyChanges, ButtonType.CANCEL);
try {
FXMLLoader fxmlLoader = new FXMLLoader(ClassLoader.getSystemClassLoader().getResource("PerceptionActionAgent.fxml"));
Parent root = fxmlLoader.load();
dialog.getDialogPane().setContent(root);
dialog.setResultConverter(dialogButton -> {
if (dialogButton == applyChanges) {
PerceptionActionAgentController configurationController = fxmlLoader.getController();
for (PerceptionActionAgentController.PerceptionRule rule : configurationController.tableContent) {
((PerceptionAction) getAlgorithm()).addRule(rule.getLeft(), rule.getRight(), rule.getUp(), rule.getDown(), Directions.valueOf(rule.getAction()));
}
return null;
}
return null;
});
} catch (IOException e) {
new ErrorView("No possible load agent configuration");
e.printStackTrace();
}
Optional<String> s = dialog.showAndWait();
}
示例4: prepareDialog
import javafx.scene.control.Dialog; //导入方法依赖的package包/类
/**
* Initialize a dialog by setting its title, header and content
* and set window style to "utility dialog".
*
* @param dialog The dialog to initialize
* @param keyTitle Key for dialog title in the translation file
* @param keyHeader Key for dialog header in the translation file
* @param keyContent Key for dialog content in the translation file
* @param windowData The position and size of the parent window
*/
protected static void prepareDialog(final Dialog dialog, final String keyTitle,
final String keyHeader, final String keyContent, final ParentWindowData windowData) {
dialog.setTitle(TRANSLATIONS.getString(keyTitle));
dialog.setHeaderText(TRANSLATIONS.getString(keyHeader));
dialog.setContentText(TRANSLATIONS.getString(keyContent));
((Stage) dialog.getDialogPane().getScene().getWindow()).initStyle(StageStyle.UTILITY);
dialog.setResizable(false);
/* Handler to place the dialog in the middle of the main window instead of the middle
* of the screen; the width oh the dialog is fixed. */
dialog.setOnShown(new EventHandler<DialogEvent>() {
public void handle(final DialogEvent event) {
dialog.setWidth(DIALOG_WIDTH);
dialog.getDialogPane().setMaxWidth(DIALOG_WIDTH);
dialog.getDialogPane().setMinWidth(DIALOG_WIDTH);
dialog.setX(windowData.getX() + (windowData.getWidth() / 2) - (dialog.getWidth() / 2));
dialog.setY(windowData.getY() + 30);
}
});
}
示例5: pickStylerToConfigure
import javafx.scene.control.Dialog; //导入方法依赖的package包/类
private void pickStylerToConfigure(final List<Parameterizable> stylers) {
if (stylers.size() == 1) {
selectInCombo(stylers.get(0));
return;
} else if (stylers.isEmpty()) {
selectInCombo(null);
return;
}
List<ParameterizableWrapper> pw = new ArrayList<>(stylers.size());
stylers.stream().forEach((p) -> {
pw.add(new ParameterizableWrapper(p));
});
Dialog<ParameterizableWrapper> dialog = new ChoiceDialog<>(pw.get(0), pw);
ButtonType bt = new ButtonType("choose", ButtonBar.ButtonData.OK_DONE);
dialog.getDialogPane().getButtonTypes().clear();
dialog.getDialogPane().getButtonTypes().add(bt);
dialog.setTitle("Please choose");
dialog.setHeaderText(null);
dialog.setResizable(true);
dialog.setContentText("choose the styler or condition you want to configure");
Optional<ParameterizableWrapper> choice = dialog.showAndWait();
if (choice.isPresent()) {
selectInCombo(choice.get().p);
}
}
示例6: showConfirmationDialogAndWait
import javafx.scene.control.Dialog; //导入方法依赖的package包/类
/**
* If there are any steps in the pipeline, give the user a chance to cancel an action or save the
* current project.
*
* @return true If the user has not chosen to
*/
private boolean showConfirmationDialogAndWait() {
if (!pipeline.getSteps().isEmpty() && project.isSaveDirty()) {
final ButtonType save = new ButtonType("Save");
final ButtonType dontSave = ButtonType.NO;
final ButtonType cancel = ButtonType.CANCEL;
final Dialog<ButtonType> dialog = new Dialog<>();
dialog.getDialogPane().getStylesheets().addAll(root.getStylesheets());
dialog.getDialogPane().setStyle(root.getStyle());
dialog.setTitle("Save Project?");
dialog.setHeaderText("Save the current project first?");
dialog.getDialogPane().getButtonTypes().setAll(save, dontSave, cancel);
if (!dialog.showAndWait().isPresent()) {
return false;
} else if (dialog.getResult().equals(cancel)) {
return false;
} else if (dialog.getResult().equals(save)) {
// If the user chose "Save", automatically show a save dialog and block until the user
// has had a chance to save the project.
return saveProject();
}
}
return true;
}
示例7: deploy
import javafx.scene.control.Dialog; //导入方法依赖的package包/类
@FXML
protected void deploy() {
eventBus.post(new WarningEvent(
"Deploy has been deprecated",
"The deploy tool has been deprecated and is no longer supported. "
+ "It will be removed in a future release.\n\n"
+ "Instead, use code generation to create a Java, C++, or Python class that handles all"
+ " the OpenCV code and can be easily integrated into a WPILib robot program."));
ImageView graphic = new ImageView(new Image("/edu/wpi/grip/ui/icons/settings.png"));
graphic.setFitWidth(DPIUtility.SMALL_ICON_SIZE);
graphic.setFitHeight(DPIUtility.SMALL_ICON_SIZE);
deployPane.requestFocus();
Dialog<ButtonType> dialog = new Dialog<>();
dialog.setTitle("Deploy");
dialog.setHeaderText("Deploy");
dialog.setGraphic(graphic);
dialog.getDialogPane().getButtonTypes().setAll(ButtonType.CLOSE);
dialog.getDialogPane().styleProperty().bind(root.styleProperty());
dialog.getDialogPane().getStylesheets().setAll(root.getStylesheets());
dialog.getDialogPane().setContent(deployPane);
dialog.setResizable(true);
dialog.showAndWait();
}
示例8: colorInput
import javafx.scene.control.Dialog; //导入方法依赖的package包/类
@Override
public Optional<Color> colorInput(String action, String question, Color _default) {
Dialog<Color> dialog = new Dialog<>();
dialog.setTitle(action);
dialog.setHeaderText(question);
ColorPicker picker = new ColorPicker(_default);
Button randomiser = new Button("Mix");
randomiser.setOnAction(e -> {
Color current = picker.getValue();
Color shifted = Item.shiftColor(current);
picker.setValue(shifted);
});
HBox box = new HBox();
box.getChildren().addAll(picker, randomiser);
dialog.getDialogPane().setContent(box);
dialog.getDialogPane().getButtonTypes().addAll(
ButtonType.OK, ButtonType.CANCEL);
dialog.setResultConverter(buttonType -> {
if (buttonType.equals(ButtonType.OK)) {
return picker.getValue();
} else {
return null;
}
});
return dialog.showAndWait();
}
示例9: getDialog
import javafx.scene.control.Dialog; //导入方法依赖的package包/类
public Dialog<String[]> getDialog(ButtonType ok) {
Dialog<String[]> dialog = new Dialog<String[]>();
dialog.setTitle(Values.MAIN_TITLE);
dialog.setHeaderText(null);
dialog.initModality(Modality.APPLICATION_MODAL);
// 自定义确认和取消按钮
ButtonType cancel = new ButtonType(Values.CANCEL, ButtonData.CANCEL_CLOSE);
dialog.getDialogPane().getButtonTypes().addAll(ok, cancel);
return dialog;
}
示例10: setupDialog
import javafx.scene.control.Dialog; //导入方法依赖的package包/类
private static void setupDialog(Window owner, String title, String headerText, String contentText, Dialog<?> alert) {
alert.setTitle(title);
alert.setHeaderText(headerText);
alert.setContentText(contentText);
alert.initOwner(owner);
alert.initModality(Modality.WINDOW_MODAL);
}
示例11: showDailySectionChooserDialog
import javafx.scene.control.Dialog; //导入方法依赖的package包/类
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();
}
示例12: showDeleteProjectDialog
import javafx.scene.control.Dialog; //导入方法依赖的package包/类
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);
}
示例13: showNewDailySectionDialog
import javafx.scene.control.Dialog; //导入方法依赖的package包/类
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();
}
示例14: showYesOrNoDialog
import javafx.scene.control.Dialog; //导入方法依赖的package包/类
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;
}
示例15: createNewProject
import javafx.scene.control.Dialog; //导入方法依赖的package包/类
public void createNewProject(ActionEvent e){
Dialog<String> dialog = new TextInputDialog("Untitled");
dialog.setTitle("New project");
dialog.setHeaderText("Please enter project name");
Optional<String> name = dialog.showAndWait();
if(!name.isPresent()){
return;
}
Project project = Project.createDefault(name.get());
startProjectMainPage(project);
}