本文整理匯總了Java中javafx.scene.control.Dialog.setResizable方法的典型用法代碼示例。如果您正苦於以下問題:Java Dialog.setResizable方法的具體用法?Java Dialog.setResizable怎麽用?Java Dialog.setResizable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.scene.control.Dialog
的用法示例。
在下文中一共展示了Dialog.setResizable方法的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: initialize
import javafx.scene.control.Dialog; //導入方法依賴的package包/類
@Override
public void initialize(URL location, ResourceBundle resources) {
logoImg.setImage(UIUtils.getImage("logo.png"));
Dialog diag = new Dialog();
diag.getDialogPane().setContent(borderPane);
diag.getDialogPane().setBackground(Background.EMPTY);
diag.setResizable(true);
UIUtils.setIcon(diag);
ButtonType closeButton = new ButtonType("Close", ButtonBar.ButtonData.OK_DONE);
diag.getDialogPane().getButtonTypes().addAll(closeButton);
diag.setTitle("About HueSense");
Optional<ButtonType> opt = diag.showAndWait();
if (opt.isPresent() && opt.get().getButtonData() == ButtonBar.ButtonData.OK_DONE) {
// nothing
}
}
示例3: 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);
}
});
}
示例4: 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();
}
示例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: 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();
}
示例7: 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);
});
}
示例8: loadProject
import javafx.scene.control.Dialog; //導入方法依賴的package包/類
private void loadProject() {
Path file = Gui.requestFile("Select matches file", gui.getScene().getWindow(), getMatchesLoadExtensionFilters(), true);
if (file == null) return;
List<Path> paths = new ArrayList<>();
Dialog<List<Path>> dialog = new Dialog<>();
//dialog.initModality(Modality.APPLICATION_MODAL);
dialog.setResizable(true);
dialog.setTitle("Project paths");
dialog.getDialogPane().getButtonTypes().addAll(ButtonType.OK, ButtonType.CANCEL);
Node okButton = dialog.getDialogPane().lookupButton(ButtonType.OK);
dialog.getDialogPane().setContent(new LoadProjectPane(paths, dialog.getOwner(), okButton));
dialog.setResultConverter(button -> button == ButtonType.OK ? paths : null);
dialog.showAndWait().ifPresent(newConfig -> {
if (paths.isEmpty()) return;
gui.getMatcher().reset();
gui.onProjectChange();
gui.runProgressTask("Initializing files...",
progressReceiver -> gui.getMatcher().readMatches(file, paths, progressReceiver),
() -> gui.onProjectChange(),
Throwable::printStackTrace);
});
}
示例9: entitySearchDialog
import javafx.scene.control.Dialog; //導入方法依賴的package包/類
public static <T extends Entity<T>> Optional<List<T>> entitySearchDialog(Query<T> query, boolean multiSelect) {
try {
FXMLLoader loader = new FXMLLoader(EntityGuiController.class.getResource("/fxml/Collection.fxml"));
AnchorPane content = (AnchorPane) loader.load();
final ControllerCollection<T> controller = loader.<ControllerCollection<T>>getController();
controller.setQuery(query, false, false, false, multiSelect);
Dialog<List<T>> dialog = new Dialog<>();
dialog.setHeight(800);
if (multiSelect) {
dialog.setTitle("Choose one or more " + EntityType.singleForClass(query.getEntityType().getType()).getName());
} else {
dialog.setTitle("Choose a " + EntityType.singleForClass(query.getEntityType().getType()).getName());
}
dialog.setResizable(true);
dialog.getDialogPane().setContent(content);
ButtonType buttonTypeOk = new ButtonType("Set", ButtonBar.ButtonData.OK_DONE);
dialog.getDialogPane().getButtonTypes().add(buttonTypeOk);
ButtonType buttonTypeCancel = new ButtonType("Cancel", ButtonBar.ButtonData.CANCEL_CLOSE);
dialog.getDialogPane().getButtonTypes().add(buttonTypeCancel);
dialog.setResultConverter((ButtonType button) -> {
if (button == buttonTypeOk) {
if (multiSelect) {
return controller.getSelectedEntities();
}
List<T> list = new ArrayList<>();
list.add(controller.getSelectedEntity());
return list;
}
return null;
});
return dialog.showAndWait();
} catch (IOException ex) {
LoggerFactory.getLogger(EntityGuiController.class).error("Failed to load Tab.", ex);
return Optional.empty();
}
}
示例10: showPrefsDialog
import javafx.scene.control.Dialog; //導入方法依賴的package包/類
/**
* Shows a dialog for editing the properties of this tab.
*/
public void showPrefsDialog() {
// Use a flushable property here to prevent a call to populate() on every keystroke in the editor (!)
FlushableProperty<String> flushableSourcePrefix = new FlushableProperty<>(sourcePrefix);
FlushableProperty<Number> flushableTileSize = new FlushableProperty<>(getWidgetPane().tileSizeProperty());
ExtendedPropertySheet propertySheet = new ExtendedPropertySheet(
Arrays.asList(
this.title,
this.autoPopulate,
flushableSourcePrefix,
flushableTileSize,
getWidgetPane().showGridProperty()
));
propertySheet.getItems().addAll(
new ExtendedPropertySheet.PropertyItem<>(getWidgetPane().hgapProperty(), "Horizontal spacing"),
new ExtendedPropertySheet.PropertyItem<>(getWidgetPane().vgapProperty(), "Vertical spacing")
);
Dialog<ButtonType> dialog = new Dialog<>();
dialog.getDialogPane().getStylesheets().setAll(AppPreferences.getInstance().getTheme().getStyleSheets());
dialog.setResizable(true);
dialog.titleProperty().bind(EasyBind.map(this.title, t -> t + " Preferences"));
dialog.getDialogPane().setContent(new BorderPane(propertySheet));
dialog.getDialogPane().getButtonTypes().addAll(ButtonType.CLOSE);
dialog.setOnCloseRequest(__ -> {
flushableSourcePrefix.flush();
flushableTileSize.flush();
});
dialog.showAndWait();
}
示例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: createDiffDialog
import javafx.scene.control.Dialog; //導入方法依賴的package包/類
public void createDiffDialog(MergeDiffInfo<?> mergeDiff, String title, Window owner) {
final FactoryDiffWidget factoryDiffWidget = new FactoryDiffWidget(uniformDesign,attributeEditorBuilder);
factoryDiffWidget.updateMergeDiff(mergeDiff);
Dialog<Void> dialog = new Dialog<>();
dialog.initOwner(owner);
dialog.setTitle(title);
dialog.setHeaderText(title);
ButtonType loginButtonType = new ButtonType("OK", ButtonBar.ButtonData.OK_DONE);
dialog.getDialogPane().getButtonTypes().addAll(loginButtonType/*, ButtonType.CANCEL*/);
final BorderPane pane = new BorderPane();
final Node diffWidgetContent = factoryDiffWidget.createContent();
pane.setCenter(diffWidgetContent);
pane.setPrefWidth(1000);
pane.setPrefHeight(750);
dialog.getDialogPane().setContent(pane);
dialog.setResizable(true);
dialog.getDialogPane().getStylesheets().add(getClass().getResource("/de/factoryfx/javafx/css/app.css").toExternalForm());
if (!mergeDiff.hasNoConflicts()){
dialog.setTitle("Konflikte");
dialog.setHeaderText("Konflikte");
diffWidgetContent.getStyleClass().add("error");
}
dialog.showAndWait();
}
示例15: showDialog
import javafx.scene.control.Dialog; //導入方法依賴的package包/類
/**
* 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;
}