List of usage examples for javafx.scene.layout VBox setVgrow
public static void setVgrow(Node child, Priority value)
From source file:Main.java
@Override public void start(final Stage stage) { stage.setTitle("HTML"); stage.setWidth(500);// ww w .jav a2 s .c o m stage.setHeight(500); Scene scene = new Scene(new Group()); VBox vbox = new VBox(); ListView list = new ListView(); VBox.setVgrow(list, Priority.ALWAYS); vbox.getChildren().addAll(new Label("Names:"), list); scene.setRoot(vbox); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { TextArea myTextArea = new TextArea(); VBox hbox = new VBox(); hbox.getChildren().add(myTextArea); VBox.setVgrow(myTextArea, Priority.ALWAYS); Scene scene = new Scene(hbox, 320, 112, Color.rgb(0, 0, 0, 0)); primaryStage.setScene(scene);/*from ww w . ja v a2 s. com*/ primaryStage.show(); }
From source file:Main.java
private VBox getCenter() { Label nameLbl = new Label("Name:"); TextField nameFld = new TextField(); HBox.setHgrow(nameFld, Priority.ALWAYS); HBox nameFields = new HBox(nameLbl, nameFld); Label descLbl = new Label("Description:"); TextArea descText = new TextArea(); descText.setPrefColumnCount(20);//from ww w.j a va 2s . c o m descText.setPrefRowCount(5); VBox.setVgrow(descText, Priority.ALWAYS); VBox center = new VBox(nameFields, descLbl, descText); return center; }
From source file:Main.java
@Override public void start(Stage stage) { VBox box = new VBox(); Scene scene = new Scene(box, 200, 200); stage.setScene(scene);//from w ww . j av a 2s. c o m stage.setTitle("ListViewSample"); box.getChildren().addAll(list, label); VBox.setVgrow(list, Priority.ALWAYS); label.setLayoutX(10); label.setLayoutY(115); label.setFont(Font.font("Verdana", 20)); list.setItems(data); list.setCellFactory(new Callback<ListView<String>, ListCell<String>>() { @Override public ListCell<String> call(ListView<String> list) { return new ColorRectCell(); } }); list.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<String>() { public void changed(ObservableValue<? extends String> ov, String old_val, String new_val) { label.setText(new_val); label.setTextFill(Color.web(new_val)); } }); stage.show(); }
From source file:net.noctuasource.noctua.core.ui.ExceptionDialog.java
protected ExceptionDialog(Exception exception) { this.exception = exception; VBox root = new VBox(); stage = new Stage(); stage.initModality(Modality.APPLICATION_MODAL); stage.setTitle("Exception"); Scene scene = new Scene(root); scene.getStylesheets().add(getClass().getResource(CSS_FILE).toExternalForm()); stage.setScene(scene);/* w ww. jav a 2 s.c o m*/ FXMLLoader loader = new FXMLLoader(); loader.setClassLoader(getClass().getClassLoader()); loader.setController(this); loader.setLocation(getClass().getResource(FXML_FILE)); try { Node node = (Node) loader.load(); root.getChildren().add(node); VBox.setVgrow(node, Priority.ALWAYS); } catch (IOException e) { logger.error("Error while creating view: ", e); stage.close(); return; } messageField.setText(exception.getLocalizedMessage()); fullExceptionField.setText(ExceptionUtils.getFullStackTrace(exception)); //stage.sizeToScene(); stage.centerOnScreen(); stage.show(); }
From source file:Main.java
WizardPage(String title) { getChildren().add(// ww w .j a v a 2s . c o m LabelBuilder.create().text(title).style("-fx-font-weight: bold; -fx-padding: 0 0 5 0;").build()); setId(title); setSpacing(5); setStyle( "-fx-padding:10; -fx-background-color: honeydew; -fx-border-color: derive(honeydew, -30%); -fx-border-width: 3;"); Region spring = new Region(); VBox.setVgrow(spring, Priority.ALWAYS); getChildren().addAll(getContent(), spring, getButtons()); priorButton.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent actionEvent) { priorPage(); } }); nextButton.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent actionEvent) { nextPage(); } }); cancelButton.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent actionEvent) { getWizard().cancel(); } }); finishButton.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent actionEvent) { getWizard().finish(); } }); }
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);//ww w . j a v a 2s .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:org.pdfsam.merge.MergeModule.java
@Override protected Pane getInnerPanel() { VBox pane = new VBox(); pane.setAlignment(Pos.TOP_CENTER);//from ww w . j a v a2 s . c o m VBox.setVgrow(selectionPane, Priority.ALWAYS); pane.getChildren().addAll(selectionPane, titledPane(DefaultI18nContext.getInstance().i18n("Merge settings"), mergeOptions), titledPane(DefaultI18nContext.getInstance().i18n("Destination file"), destinationPane)); return pane; }
From source file:org.pdfsam.rotate.RotateModule.java
@Override protected Pane getInnerPanel() { VBox pane = new VBox(); pane.setAlignment(Pos.TOP_CENTER);/*from w w w . j av a2 s. c om*/ VBox.setVgrow(selectionPane, Priority.ALWAYS); TitledPane prefixTitled = Views.titledPane(DefaultI18nContext.getInstance().i18n("File names settings"), prefix); prefix.addMenuItemFor(Prefix.FILENUMBER); TitledPane options = Views.titledPane(DefaultI18nContext.getInstance().i18n("Rotate settings"), rotateOptions); pane.getChildren().addAll(selectionPane, options, Views.titledPane(DefaultI18nContext.getInstance().i18n("Destination directory"), destinationPane), prefixTitled); return pane; }
From source file:gov.va.isaac.sync.view.SyncView.java
private void initGui() { root_ = new BorderPane(); root_.setPrefWidth(550);//from w ww . j av a 2s . com VBox titleBox = new VBox(); Label title = new Label("Datastore Synchronization"); title.getStyleClass().add("titleLabel"); title.setAlignment(Pos.CENTER); title.setMaxWidth(Double.MAX_VALUE); title.setPadding(new Insets(10)); titleBox.getChildren().add(title); titleBox.getStyleClass().add("headerBackground"); url_ = AppContext.getAppConfiguration().getCurrentChangeSetUrl(); String urlType = AppContext.getAppConfiguration().getChangeSetUrlTypeName(); String syncUsername = ExtendedAppContext.getCurrentlyLoggedInUserProfile().getSyncUsername(); if (StringUtils.isBlank(syncUsername)) { syncUsername = ExtendedAppContext.getCurrentlyLoggedInUser(); } url_ = syncService_.substituteURL(url_, syncUsername); Label info = new CopyableLabel("Sync using " + urlType + ": " + url_); info.setTooltip(new Tooltip(url_)); titleBox.getChildren().add(info); titleBox.setPadding(new Insets(5, 5, 5, 5)); root_.setTop(titleBox); VBox centerContent = new VBox(); centerContent.setFillWidth(true); centerContent.setPrefWidth(Double.MAX_VALUE); centerContent.setPadding(new Insets(10)); centerContent.getStyleClass().add("itemBorder"); centerContent.setSpacing(10.0); centerContent.getChildren().add(new Label("Status:")); summary_ = new TextArea(); summary_.setWrapText(true); summary_.setEditable(false); summary_.setMaxWidth(Double.MAX_VALUE); summary_.setMaxHeight(Double.MAX_VALUE); summary_.setPrefHeight(150.0); centerContent.getChildren().add(summary_); VBox.setVgrow(summary_, Priority.ALWAYS); pb_ = new ProgressBar(0.0); pb_.setPrefHeight(20); pb_.setMaxWidth(Double.MAX_VALUE); centerContent.getChildren().add(pb_); root_.setCenter(centerContent); //Bottom buttons HBox buttons = new HBox(); buttons.setMaxWidth(Double.MAX_VALUE); buttons.setAlignment(Pos.CENTER); buttons.setPadding(new Insets(5)); buttons.setSpacing(30); Button cancel = new Button("Close"); cancel.setOnAction((action) -> { if (running_.get()) { addLine("Cancelling..."); cancel.setDisable(true); cancelRequested_ = true; } else { cancel.getScene().getWindow().hide(); root_ = null; } }); buttons.getChildren().add(cancel); Button action = new Button("Synchronize"); action.disableProperty().bind(running_); action.setOnAction((theAction) -> { summary_.setText(""); pb_.setProgress(-1.0); running_.set(true); Utility.execute(() -> sync()); }); buttons.getChildren().add(action); cancel.minWidthProperty().bind(action.widthProperty()); running_.addListener(change -> { if (running_.get()) { cancel.setText("Cancel"); } else { cancel.setText("Close"); } cancel.setDisable(false); }); root_.setBottom(buttons); }