List of usage examples for javafx.scene.layout Priority ALWAYS
Priority ALWAYS
To view the source code for javafx.scene.layout Priority ALWAYS.
Click Source Link
From source file:org.pdfsam.ui.news.NewsStage.java
@Inject public NewsStage(Collection<Image> logos, StylesConfig styles, @Named("newsDisplayPolicy") PreferenceComboBox<KeyStringValueItem<String>> newsDisplayPolicy) { BorderPane containerPane = new BorderPane(); browser.setId("newsBrowser"); containerPane.getStyleClass().addAll(Style.CONTAINER.css()); containerPane.getStyleClass().add("-pdfsam-news-pane"); containerPane.setCenter(browser);//from w w w . j ava 2 s . c o m HBox bottom = new HBox(); ClosePane closePane = new ClosePane(); HBox.setHgrow(closePane, Priority.ALWAYS); HBox comboPanel = new HBox(new Label(DefaultI18nContext.getInstance().i18n("Show this:")), newsDisplayPolicy); comboPanel.getStyleClass().addAll(Style.CONTAINER.css()); comboPanel.getStyleClass().add("-pdfsam-news-pane-bottom"); bottom.getChildren().addAll(comboPanel, closePane); containerPane.setBottom(bottom); Scene scene = new Scene(containerPane); scene.getStylesheets().addAll(styles.styles()); scene.setOnKeyReleased(new HideOnEscapeHandler(this)); setScene(scene); setTitle(DefaultI18nContext.getInstance().i18n("What's new")); getIcons().addAll(logos); setMaximized(false); }
From source file:de.perdian.apps.tagtiger.fx.handlers.batchupdate.UpdateFileNamesFromTagsActionEventHandler.java
@Override protected BatchUpdateDialog createDialog() { ObservableList<UpdateFileNamesFromTagsItem> items = FXCollections.observableArrayList( this.getOtherFiles().stream().map(UpdateFileNamesFromTagsItem::new).collect(Collectors.toList())); StringProperty patternFieldProperty = new SimpleStringProperty(); List<String> patternItems = Arrays.asList("${track} ${title}"); ComboBox<String> patternBox = new ComboBox<>(FXCollections.observableArrayList(patternItems)); patternBox.setEditable(true);//from ww w . j av a2s . c o m patternBox.setMaxWidth(Double.MAX_VALUE); Bindings.bindBidirectional(patternFieldProperty, patternBox.editorProperty().get().textProperty()); HBox.setHgrow(patternBox, Priority.ALWAYS); Button executeButton = new Button(this.getLocalization().executeRename(), new ImageView(new Image(UpdateFileNamesFromTagsActionEventHandler.class.getClassLoader() .getResourceAsStream("icons/16/save.png")))); executeButton.setDisable(true); patternFieldProperty .addListener((o, oldValue, newValue) -> executeButton.setDisable(newValue.length() <= 0)); HBox patternFieldPane = new HBox(10, patternBox, executeButton); patternFieldPane.setPadding(new Insets(5, 5, 5, 5)); TitledPane patternFieldTitlePane = new TitledPane(this.getLocalization().fileNamePattern(), patternFieldPane); patternFieldTitlePane.setCollapsible(false); TableView<?> newFileNamesPane = this.createNewFileNamesPane(items); newFileNamesPane.setPrefHeight(400); VBox.setVgrow(newFileNamesPane, Priority.ALWAYS); VBox actionPane = new VBox(10, patternFieldTitlePane, newFileNamesPane); // Create the dialog and finish BatchUpdateDialog dialog = new BatchUpdateDialog(); dialog.setDialogPrefWidth(800); dialog.setDialogTitle(this.getLocalization().updateFileNames()); dialog.setActionPane(actionPane); dialog.setLegendPane(this.createLegendPane()); // Add listeners this.getOtherFiles().addListener( new WeakListChangeListener<>((Change<? extends TaggableFile> change) -> items.setAll(change .getList().stream().map(UpdateFileNamesFromTagsItem::new).collect(Collectors.toList())))); patternFieldProperty.addListener((o, oldValue, newValue) -> this.computeNewFileNames(items, newValue)); executeButton.setOnAction(event -> { this.updateNewFileNames(items); ((Stage) executeButton.getScene().getWindow()).close(); }); return dialog; }
From source file:com.canoo.dolphin.todo.client.ToDoClient.java
private void showError(String header, String content, Exception e) { e.printStackTrace();//from ww w . j av a 2 s .co m Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("Error"); alert.setHeaderText(header); alert.setContentText(content); StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); e.printStackTrace(pw); String exceptionText = sw.toString(); Label label = new Label("The exception stacktrace was:"); TextArea textArea = new TextArea(exceptionText); textArea.setEditable(false); textArea.setWrapText(true); textArea.setMaxWidth(Double.MAX_VALUE); textArea.setMaxHeight(Double.MAX_VALUE); GridPane.setVgrow(textArea, Priority.ALWAYS); GridPane.setHgrow(textArea, Priority.ALWAYS); GridPane expContent = new GridPane(); expContent.setMaxWidth(Double.MAX_VALUE); expContent.add(label, 0, 0); expContent.add(textArea, 0, 1); alert.getDialogPane().setExpandableContent(expContent); alert.showAndWait(); System.exit(-1); }
From source file:de.perdoctus.ebikeconnect.gui.dialogs.LoginDialog.java
@PostConstruct public void init() { final ImageView graphic = new ImageView( new Image(getClass().getResource("/app-icon.png").toExternalForm())); graphic.setPreserveRatio(true);//from ww w. j ava 2 s . co m graphic.setFitHeight(64); setGraphic(graphic); setResizable(true); setWidth(400); setResizable(false); setTitle(rb.getString("dialogTitle")); setHeaderText(rb.getString("dialogMessage")); final ButtonType loginButtonType = new ButtonType(rb.getString("loginButton"), ButtonBar.ButtonData.OK_DONE); getDialogPane().getButtonTypes().addAll(loginButtonType, ButtonType.CANCEL); // Create the username and password labels and fields. final GridPane grid = new GridPane(); grid.setHgap(10); grid.setVgap(10); grid.setPadding(new Insets(20, 10, 10, 10)); grid.setPrefWidth(getWidth()); grid.getColumnConstraints().add(new ColumnConstraints(-1, -1, -1, Priority.NEVER, HPos.LEFT, true)); grid.getColumnConstraints().add(new ColumnConstraints(-1, -1, -1, Priority.ALWAYS, HPos.LEFT, true)); final String rbUsername = rb.getString(CFG_USERNAME); final TextField txtUsername = new TextField(); txtUsername.setPromptText(rbUsername); txtUsername.setText(config.getString(CFG_USERNAME, "")); final Label lblUsername = new Label(rbUsername); lblUsername.setLabelFor(txtUsername); grid.add(lblUsername, 0, 0); grid.add(txtUsername, 1, 0); final String rbPassword = rb.getString(CFG_PASSWORD); final PasswordField txtPassword = new PasswordField(); txtPassword.setPromptText(rbPassword); if (config.getBoolean(CFG_SAVE_PASSWORD, false)) { txtPassword.setText(config.getString(CFG_PASSWORD, "")); } final Label lblPassword = new Label(rbPassword); lblPassword.setLabelFor(txtPassword); grid.add(lblPassword, 0, 1); grid.add(txtPassword, 1, 1); final CheckBox cbSavePassword = new CheckBox(rb.getString("save-password")); cbSavePassword.setSelected(config.getBoolean(CFG_SAVE_PASSWORD, false)); grid.add(cbSavePassword, 1, 2); getDialogPane().setContent(grid); // Enable/Disable login button depending on whether a username was entered. final Node loginButton = getDialogPane().lookupButton(loginButtonType); loginButton.disableProperty() .bind(txtUsername.textProperty().isEmpty().or(txtPassword.textProperty().isEmpty())); setResultConverter(buttonType -> { if (buttonType == loginButtonType) { config.setProperty(CFG_USERNAME, txtUsername.getText()); config.setProperty(CFG_SAVE_PASSWORD, cbSavePassword.isSelected()); if (cbSavePassword.isSelected()) { config.setProperty(CFG_PASSWORD, txtPassword.getText()); config.setProperty(CFG_PASSWORD, txtPassword.getText()); } else { config.clearProperty(CFG_PASSWORD); } return new Credentials(txtUsername.getText(), txtPassword.getText()); } else { return null; } }); if (txtUsername.getText().isEmpty()) { txtUsername.requestFocus(); } else { txtPassword.requestFocus(); txtPassword.selectAll(); } }
From source file:Main.java
private GridPane createGridPane() { final GridPane gp = new GridPane(); gp.setPadding(new Insets(10)); gp.setHgap(20);/*from ww w. j a v a 2 s . c o m*/ //gp.add(albumCover, 0, 0, 1, GridPane.REMAINING); gp.add(title, 1, 0); gp.add(artist, 1, 1); gp.add(album, 1, 2); gp.add(year, 1, 3); final ColumnConstraints c0 = new ColumnConstraints(); final ColumnConstraints c1 = new ColumnConstraints(); c1.setHgrow(Priority.ALWAYS); gp.getColumnConstraints().addAll(c0, c1); final RowConstraints r0 = new RowConstraints(); r0.setValignment(VPos.TOP); gp.getRowConstraints().addAll(r0, r0, r0, r0); return gp; }
From source file:com.panemu.tiwulfx.form.BaseControl.java
public BaseControl(String propertyName, E control) { this.inputControl = control; this.propertyName = propertyName; HBox.setHgrow(control, Priority.ALWAYS); setAlignment(Pos.CENTER_LEFT);//from w ww . ja v a2 s . c o m control.setMaxWidth(Double.MAX_VALUE); control.setMinHeight(USE_PREF_SIZE); getChildren().add(control); getChildren().add(imagePlaceHolder); required.addListener(imageListener); valid.addListener(imageListener); this.getStyleClass().add("form-control"); value = new SimpleObjectProperty<>(); bindValuePropertyWithControl(control); bindEditablePropertyWithControl(control); addEventHandler(MouseEvent.ANY, new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { if (event.getEventType() == MouseEvent.MOUSE_MOVED && !isValid() && !getPopup().isShowing()) { Point2D p = BaseControl.this.localToScene(0.0, 0.0); getPopup().show(BaseControl.this, p.getX() + getScene().getX() + getScene().getWindow().getX(), p.getY() + getScene().getY() + getScene().getWindow().getY() + getInputComponent().getHeight() - 1); } else if (event.getEventType() == MouseEvent.MOUSE_EXITED && getPopup().isShowing()) { getPopup().hide(); } } }); getInputComponent().addEventHandler(MouseEvent.MOUSE_ENTERED, new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent t) { if (!isValid() && getPopup().isShowing()) { getPopup().hide(); } } }); }
From source file:com.panemu.tiwulfx.form.BaseListControl.java
public BaseListControl(String propertyName, E control) { this.inputControl = control; this.propertyName = propertyName; HBox.setHgrow(control, Priority.ALWAYS); setAlignment(Pos.CENTER_LEFT);//w w w. ja v a2 s . c o m control.setMaxWidth(Double.MAX_VALUE); control.setMinHeight(USE_PREF_SIZE); getChildren().add(control); getChildren().add(imagePlaceHolder); required.addListener(imageListener); valid.addListener(imageListener); this.getStyleClass().add("form-control"); value = new SimpleListProperty<>(); bindValuePropertyWithControl(control); bindEditablePropertyWithControl(control); addEventHandler(MouseEvent.ANY, new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { if (event.getEventType() == MouseEvent.MOUSE_MOVED && !isValid() && !getPopup().isShowing()) { Point2D p = BaseListControl.this.localToScene(0.0, 0.0); getPopup().show(BaseListControl.this, p.getX() + getScene().getX() + getScene().getWindow().getX(), p.getY() + getScene().getY() + getScene().getWindow().getY() + getInputComponent().getHeight() - 1); } else if (event.getEventType() == MouseEvent.MOUSE_EXITED && getPopup().isShowing()) { getPopup().hide(); } } }); getInputComponent().addEventHandler(MouseEvent.MOUSE_ENTERED, new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent t) { if (!isValid() && getPopup().isShowing()) { getPopup().hide(); } } }); }
From source file:com.github.drbookings.ui.controller.BookingDetailsController.java
private static void addName(final HBox content, final BookingBean be) { final Label label = new Label(be.getGuest().getName() + "\n" + be.getBookingOrigin().getName()); label.setWrapText(true);/* ww w. j a v a 2 s. c o m*/ content.getChildren().add(label); HBox.setHgrow(label, Priority.ALWAYS); }
From source file:net.thirdy.blackmarket.controls.ModSelectionPane.java
public ModSelectionPane() { setHgap(5.0);/* w ww.j a v a 2 s . c o m*/ setMaxHeight(Double.MAX_VALUE); setMinHeight(560); setAlignment(Pos.CENTER); setupModListView(); accept(Collections.emptyList()); setupModMappingTable(); setupFilterTextField(); tfMinShouldMatch = new DoubleTextField("Minimum number of OR modifiers to match"); tfMinShouldMatch.setMinWidth(350); Button add = addButton(); add.setPrefWidth(150); HBox hBox = new HBox(5, new Label("Filter: "), filterField, add); hBox.setAlignment(Pos.CENTER); VBox.setVgrow(modMappingTable, Priority.ALWAYS); VBox left = new VBox(10, hBox, modMappingTable); VBox.setVgrow(modsListView, Priority.ALWAYS); Label modifiersLbl = new Label("Modifiers"); modifiersLbl.setFont(Font.font("Verdana", FontWeight.MEDIUM, 14)); modifiersLbl.setPadding(new Insets(4)); HBox minShouldMatchHBox = new HBox(3, new Label("Minimum OR Matches:"), tfMinShouldMatch); minShouldMatchHBox.setAlignment(Pos.CENTER); VBox right = new VBox(3, new StackPane(modifiersLbl), minShouldMatchHBox, modsListView); setupGridPaneColumns(); GridPane.setVgrow(left, Priority.ALWAYS); GridPane.setVgrow(right, Priority.ALWAYS); add(left, 0, 0); add(right, 1, 0); }
From source file:jobhunter.gui.dialog.SubscriptionForm.java
public Optional<Action> show() { Dialog dlg = new Dialog(null, getTranslation("message.add.subscription")); final GridPane content = new GridPane(); content.setHgap(10);// ww w . jav a 2s. c om content.setVgap(10); ObservableList<String> portals = FXCollections.observableArrayList(PreferencesController.getPortalsList()); portalField.setItems(portals); portalField.setPrefWidth(400.0); portalField.setEditable(true); portalField.setValue(subscription.getPortal()); portalField.valueProperty().addListener((observable, old, neu) -> { subscription.setPortal(neu); save.disabledProperty().set(!isValid()); }); urlField.setText(subscription.getUri()); urlField.textProperty().addListener((observable, old, neu) -> { subscription.setURI(neu); save.disabledProperty().set(!isValid()); }); titleField.setText(subscription.getTitle()); titleField.textProperty().addListener((observable, old, neu) -> { subscription.setTitle(neu); save.disabledProperty().set(!isValid()); }); historyField.setText(subscription.getHistory().toString()); historyField.textProperty().addListener((observable, old, neu) -> { subscription.setHistory(Integer.valueOf(neu)); save.disabledProperty().set(!isValid()); }); content.add(new Label(getTranslation("label.title")), 0, 0); content.add(titleField, 1, 0); GridPane.setHgrow(titleField, Priority.ALWAYS); content.add(new Label(getTranslation("label.portal")), 0, 1); content.add(portalField, 1, 1); content.add(new Label(getTranslation("label.feed.url")), 0, 2); content.add(urlField, 1, 2); GridPane.setHgrow(urlField, Priority.ALWAYS); content.add(new Label(getTranslation("label.history")), 0, 3); content.add(historyField, 1, 3); GridPane.setHgrow(historyField, Priority.ALWAYS); dlg.setResizable(false); dlg.setIconifiable(false); dlg.setContent(content); dlg.getActions().addAll(save, Dialog.Actions.CANCEL); Platform.runLater(() -> titleField.requestFocus()); l.debug("Showing dialog"); return Optional.of(dlg.show()); }