private void showLicensePopup() { Alert licenseAlert = new Alert(AlertType.INFORMATION); licenseAlert.setWidth(500); licenseAlert.setHeaderText("License"); ScrollPane scroll = new ScrollPane(); try { scroll.setContent(new TextArea(IOUtils.toString(getClass().getResourceAsStream("LICENSE"), StandardCharsets.UTF_8))); } catch (IOException e) { e.printStackTrace(); } licenseAlert.getDialogPane().setContent(scroll); licenseAlert.showAndWait(); }
); pane.setContent(grid); Platform.runLater(username::requestFocus);
dialogPane.setContent(materialNode); setDialogPane(dialogPane); dialogPane.getScene().setFill(Color.TRANSPARENT);
}); pane.setContent(box); pane.setMaxWidth(Double.MAX_VALUE);
public class CattleGenderDialog extends ChoiceDialog { public CattleGenderDialog( final Window owner ) { initOwner( owner ); // This is the key line to override button order. setDialogPane( new ButtonOrderPane() ); // This line will return the button order pane. final DialogPane dialogPane = getDialogPane(); dialogPane.setContent( pane ); dialogPane.getButtonTypes().addAll( ... ); } }
private Dialog<ButtonType> createDialog(final Window parent, final String title, final Parent root) { final Dialog<ButtonType> dlg = new Dialog<>(); dlg.initOwner(parent); dlg.setTitle(title); dlg.getDialogPane().setContent(root); dlg.setResizable(false); return dlg; }
public FontSelectorDialog(Font defaultFont) { fontPanel = new FontPanel(); fontPanel.setFont(defaultFont); setResultConverter(dialogButton -> dialogButton == ButtonType.OK ? fontPanel.getFont() : null); final DialogPane dialogPane = getDialogPane(); setTitle(localize(asKey("font.dlg.title"))); //$NON-NLS-1$ dialogPane.setHeaderText(localize(asKey("font.dlg.header"))); //$NON-NLS-1$ dialogPane.getStyleClass().add("font-selector-dialog"); //$NON-NLS-1$ dialogPane.getStylesheets().add(FontSelectorDialog.class.getResource("dialogs.css").toExternalForm()); //$NON-NLS-1$ dialogPane.getButtonTypes().addAll(ButtonType.OK, ButtonType.CANCEL); dialogPane.setContent(fontPanel); }
/** * Workaround for the bug that messages are not completely displayed if text is wrapped. * * @param alert the alert dialog * @param message the text message */ protected void setAlertMessage(Alert alert, String message) { alert.setHeaderText(null); Label textLabel = new Label(); // replace with non-wrapping label! textLabel.setWrapText(false); textLabel.setText(message); alert.getDialogPane().setContent(textLabel); alert.setResizable(true); // RT-38998 }
dialogPane.setContent(new Label(contentText != null && ! contentText.isEmpty() ? contentText : exception.getMessage()));
public static <F> Optional<F> showAndWaitDialog(Window window, F parent, Function<String, F> folderCreator, Predicate<String> folderUnique) { Objects.requireNonNull(window); Objects.requireNonNull(parent); Objects.requireNonNull(folderCreator); Objects.requireNonNull(folderUnique); Dialog<F> dialog = new Dialog<>(); try { dialog.setTitle(RESOURCE_BUNDLE.getString("NewFolder")); dialog.getDialogPane().getButtonTypes().addAll(ButtonType.OK, ButtonType.CANCEL); NewFolderPane<F> newProjectPane = new NewFolderPane<>(folderCreator, folderUnique); newProjectPane.setPrefSize(350, 100); dialog.getDialogPane().lookupButton(ButtonType.OK).disableProperty().bind(newProjectPane.validatedProperty().not()); dialog.getDialogPane().setContent(newProjectPane); dialog.setResizable(true); dialog.initOwner(window); dialog.setResultConverter(buttonType -> buttonType == ButtonType.OK ? newProjectPane.createFolder() : null); return dialog.showAndWait(); } finally { dialog.close(); } } }
/** * @param owner the owner stage of this dialog * @param task the task to perform when the dialog opens */ public TaskProgressDialog(Stage owner, Task<R> task) { initOwner(owner); titleProperty().bind(task.titleProperty()); initTaskHandlers(task); getDialogPane().setContent(createContent(task)); setOnShown(event -> startTask(task)); }
public void popDialog(String title, String header, String content) { if (guiEnabled) Platform.runLater(() -> { Dialog<String> dialog = new Dialog<>(); dialog.setTitle(title); dialog.setHeaderText(header); TextArea textField = new TextArea(); dialog.setHeight(400); dialog.setResizable(true); dialog.getDialogPane().setContent(textField); dialog.getDialogPane().getButtonTypes().add(ButtonType.OK); textField.setEditable(false); textField.setText(content); textField.setWrapText(true); dialog.showAndWait(); }); if(print) System.out.println(title+":\t"+header+":\t"+content); }
/** * setup the control according to the given valueMap * * @param valueMap */ public void setup(Map<String, Object> valueMap) { // Create the custom dialog. dialog = new Dialog<Map<String, Object>>(); dialog.initOwner(stage); dialog.setTitle(I18n.get(form.getI18nId())); dialog.setHeaderText(form.getHeaderText()); // Set the icon (must be included in the project). URL iconUrl = this.getClass() .getResource("/icons/" + form.getIcon() + ".png"); if (iconUrl != null) dialog.setGraphic(new ImageView(iconUrl.toString())); // Set the button types. okButtonType = new ButtonType("Ok", ButtonData.OK_DONE); dialog.getDialogPane().getButtonTypes().addAll(okButtonType, ButtonType.CANCEL); genericPanel = new GenericPanel(getStage(),form); dialog.getDialogPane().setContent(genericPanel); if (valueMap != null) { genericPanel.setValues(valueMap); } }
vbox.getChildren().add(0, contentText); contentText.textProperty().bind(dialogPane.contentTextProperty()); dialogPane.setContent(vbox);
private void updateGrid() { grid.getChildren().clear(); // add the message to the top of the dialog updateContentText(); // then build all the buttons int row = 1; for (final ButtonType buttonType : getDialogPane().getButtonTypes()) { if (buttonType == null) continue; final Button button = (Button)getDialogPane().lookupButton(buttonType); GridPane.setHgrow(button, Priority.ALWAYS); GridPane.setVgrow(button, Priority.ALWAYS); grid.add(button, 0, row++); } // // last button gets some extra padding (hacky) // GridPane.setMargin(buttons.get(buttons.size() - 1), new Insets(0,0,10,0)); getDialogPane().setContent(grid); getDialogPane().requestLayout(); }
this.getDialogPane().setContent(repositoryDetailsPanel); this.getDialogPane().getButtonTypes().setAll(ButtonType.FINISH, ButtonType.CANCEL); }); this.getDialogPane().setContent(chooseRepositoryTypePanel); this.getDialogPane().setMinSize(Region.USE_PREF_SIZE, Region.USE_PREF_SIZE);
public static Optional<String> showAndWaitDialog(AbstractNodeBase node, Predicate<String> nodeNameUnique) { Dialog<String> dialog = new Dialog<>(); try { dialog.setTitle(RESOURCE_BUNDLE.getString("RenameFile")); dialog.getDialogPane().getButtonTypes().addAll(ButtonType.OK, ButtonType.CANCEL); RenamePane renamePane = new RenamePane(node, nodeNameUnique); renamePane.setPrefSize(350, 100); dialog.getDialogPane().lookupButton(ButtonType.OK).disableProperty().bind(renamePane.validatedProperty().not()); dialog.getDialogPane().setContent(renamePane); dialog.setResizable(true); dialog.setResultConverter(buttonType -> buttonType == ButtonType.OK ? renamePane.getNameTextField().getText() : null); return dialog.showAndWait(); } finally { dialog.close(); } } }
dialog.getDialogPane().setContent(nodeChooser); dialog.setResizable(true); dialog.initOwner(window);
pane.setPrefWidth(screenBounds.getWidth()/3); pane.setPrefHeight(screenBounds.getHeight()/2); dialog.getDialogPane().setContent(pane); dialog.setResizable(true);
pane.add(folderSelectionPane.getButton(), 3, 1); pane.add(nameTextField.getFileAlreadyExistsLabel(), 0, 2, 4, 1); dialog.getDialogPane().setContent(pane); BooleanBinding okProperty = folderSelectionPane.nodeProperty().isNotNull() .and(nameTextField.okProperty());