本文整理汇总了Java中javafx.scene.control.Dialog.setTitle方法的典型用法代码示例。如果您正苦于以下问题:Java Dialog.setTitle方法的具体用法?Java Dialog.setTitle怎么用?Java Dialog.setTitle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.Dialog
的用法示例。
在下文中一共展示了Dialog.setTitle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setup
import javafx.scene.control.Dialog; //导入方法依赖的package包/类
private void setup() {
ProjectConfig config = ProjectConfig.getLast();
Dialog<ProjectConfig> dialog = new Dialog<>();
//dialog.initModality(Modality.APPLICATION_MODAL);
dialog.setResizable(true);
dialog.setTitle("UID Setup");
dialog.getDialogPane().getButtonTypes().addAll(ButtonType.OK, ButtonType.CANCEL);
Node okButton = dialog.getDialogPane().lookupButton(ButtonType.OK);
UidSetupPane setupPane = new UidSetupPane(config, dialog.getOwner(), okButton);
dialog.getDialogPane().setContent(setupPane);
dialog.setResultConverter(button -> button == ButtonType.OK ? config : null);
dialog.showAndWait().ifPresent(newConfig -> {
setupPane.updateConfig();
if (!newConfig.isValid()) return;
newConfig.saveAsLast();
});
}
示例2: 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();
}
});
}
示例3: showAbout
import javafx.scene.control.Dialog; //导入方法依赖的package包/类
public void showAbout(ActionEvent actionEvent) throws URISyntaxException {
Dialog<Void> dialog = new Dialog<>();
dialog.setTitle("Tenhou Visualizer について");
dialog.initOwner(this.root.getScene().getWindow());
dialog.getDialogPane().getStylesheets().add(this.getClass().getResource(Main.properties.getProperty("css")).toExternalForm());
dialog.getDialogPane().setGraphic(new ImageView(new Image("/logo.png")));
dialog.getDialogPane().setHeaderText("TenhouVisualizer v0.3");
final Hyperlink oss = new Hyperlink("open-source software");
final URI uri = new URI("https://crazybbb.github.io/tenhou-visualizer/thirdparty");
oss.setOnAction(e -> {
try {
Desktop.getDesktop().browse(uri);
} catch (IOException e1) {
throw new UncheckedIOException(e1);
}
});
dialog.getDialogPane().setContent(new TextFlow(new Label("Powered by "), oss));
dialog.getDialogPane().getButtonTypes().add(ButtonType.CLOSE);
dialog.showAndWait();
}
示例4: 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());
}
示例5: showPropertySheet
import javafx.scene.control.Dialog; //导入方法依赖的package包/类
/**
* Creates the menu for editing the properties of a widget.
*
* @param tile the tile to pull properties from
* @return the edit property menu
*/
private void showPropertySheet(Tile<?> tile) {
ExtendedPropertySheet propertySheet = new ExtendedPropertySheet();
propertySheet.getItems().add(new ExtendedPropertySheet.PropertyItem<>(tile.getContent().titleProperty()));
Dialog<ButtonType> dialog = new Dialog<>();
if (tile.getContent() instanceof Widget) {
((Widget) tile.getContent()).getProperties().stream()
.map(ExtendedPropertySheet.PropertyItem::new)
.forEachOrdered(propertySheet.getItems()::add);
}
dialog.setTitle("Edit widget properties");
dialog.getDialogPane().getStylesheets().setAll(AppPreferences.getInstance().getTheme().getStyleSheets());
dialog.getDialogPane().setContent(new BorderPane(propertySheet));
dialog.getDialogPane().getButtonTypes().addAll(ButtonType.CLOSE);
dialog.showAndWait();
}
示例6: confirmDialog
import javafx.scene.control.Dialog; //导入方法依赖的package包/类
/**
* Displays a confirmation dialog box.
*
* @param node a node attached to the stage to be used as the owner of the dialog.
* @param header the header message for the dialog.
* @param content the main message for the dialog.
* @param icon the icon for the dialog.
* @param buttons the {@link ButtonType} that should be displayed on the confirmation dialog.
* @return the {@link ButtonType} corresponding to user's choice.
*/
public static ButtonType confirmDialog(Node node, String header, String content, Node icon, ButtonType... buttons) {
Dialog<ButtonType> dlg = new Dialog<>();
dlg.initOwner(Dialogs.getStage(node));
setAlwaysOnTop(dlg);
dlg.setTitle("binjr");
dlg.getDialogPane().setHeaderText(header);
dlg.getDialogPane().setContentText(content);
if (icon == null) {
icon = new Region();
icon.getStyleClass().addAll("dialog-icon", "help-icon");
}
dlg.getDialogPane().setGraphic(icon);
if (buttons == null || buttons.length == 0) {
buttons = new ButtonType[]{ButtonType.YES, ButtonType.NO};
}
dlg.getDialogPane().getButtonTypes().addAll(buttons);
return dlg.showAndWait().orElse(ButtonType.CANCEL);
}
示例7: 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();
}
示例8: 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();
}
示例9: create
import javafx.scene.control.Dialog; //导入方法依赖的package包/类
/**
* Create the dialog for choosing courses.
*
* @param courseList the list of courses to show in the dialog (let the user pick from them)
* @return the controller of the dialog window, enabling to display the dialog and read the selected result
*/
public ChooseCourseController create(List<Course> courseList) {
FXMLLoader fxmlLoader = this.fxmlLoader.get();
DialogPane dialogPane = null;
try (InputStream is = getClass().getResourceAsStream("ChooseCourseDialogPane.fxml")) {
dialogPane = fxmlLoader.load(is);
} catch (IOException e) {
AlertCreator.handleLoadLayoutError(fxmlLoader.getResources(), e);
}
ChooseCourseController chooseCourseController = fxmlLoader.getController();
chooseCourseController.setCourseList(courseList);
Dialog<ButtonType> dialog = new Dialog<>();
dialog.setDialogPane(dialogPane);
chooseCourseController.setDialog(dialog);
dialog.setTitle("StudyGuide");
return chooseCourseController;
}
示例10: create
import javafx.scene.control.Dialog; //导入方法依赖的package包/类
/**
* Create the dialog for entering a String.
*
* @param prompt the string message to prompt the user with
* @return the controller of the dialog window, enabling to display the dialog and read the selected result
*/
public EnterStringController create(String prompt) {
FXMLLoader fxmlLoader = this.fxmlLoader.get();
DialogPane dialogPane = null;
try (InputStream is = getClass().getResourceAsStream("EnterStringDialogPane.fxml")) {
dialogPane = fxmlLoader.load(is);
} catch (IOException e) {
AlertCreator.handleLoadLayoutError(fxmlLoader.getResources(), e);
}
dialogPane.setHeaderText(prompt);
EnterStringController enterStringController = fxmlLoader.getController();
Dialog<ButtonType> dialog = new Dialog<>();
dialog.initModality(Modality.APPLICATION_MODAL);
dialog.setDialogPane(dialogPane);
enterStringController.setDialog(dialog);
dialog.setTitle("StudyGuide");
dialog.setOnShown(event -> enterStringController.getTextField().requestFocus());
return enterStringController;
}
示例11: 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;
}
示例12: editDocument
import javafx.scene.control.Dialog; //导入方法依赖的package包/类
public Optional<String> editDocument(String formattedJson, int cursorPosition) {
Dialog<String> dialog = new Dialog<>();
dialog.getDialogPane().getButtonTypes().addAll(ButtonType.OK, ButtonType.CANCEL);
dialog.setTitle("MongoFX - edit document");
dialog.setResizable(true);
dialog.getDialogPane().getStylesheets().add(getClass().getResource("/ui/editor.css").toExternalForm());
CodeArea codeArea = setupEditorArea(formattedJson, dialog, cursorPosition);
dialog.setResultConverter(bt -> {
if (ButtonData.OK_DONE == bt.getButtonData()) {
return codeArea.getText();
}
return null;
});
return dialog.showAndWait();
}
示例13: 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);
}
}
示例14: 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();
}
示例15: newProject
import javafx.scene.control.Dialog; //导入方法依赖的package包/类
private void newProject() {
ProjectConfig config = ProjectConfig.getLast();
Dialog<ProjectConfig> dialog = new Dialog<>();
//dialog.initModality(Modality.APPLICATION_MODAL);
dialog.setResizable(true);
dialog.setTitle("Project configuration");
dialog.getDialogPane().getButtonTypes().addAll(ButtonType.OK, ButtonType.CANCEL);
Node okButton = dialog.getDialogPane().lookupButton(ButtonType.OK);
dialog.getDialogPane().setContent(new NewProjectPane(config, dialog.getOwner(), okButton));
dialog.setResultConverter(button -> button == ButtonType.OK ? config : null);
dialog.showAndWait().ifPresent(newConfig -> {
if (!newConfig.isValid()) return;
newConfig.saveAsLast();
gui.getMatcher().reset();
gui.onProjectChange();
gui.runProgressTask("Initializing files...",
progressReceiver -> gui.getMatcher().init(newConfig, progressReceiver),
() -> gui.onProjectChange(),
Throwable::printStackTrace);
});
}