Java 类javafx.scene.layout.ColumnConstraintsBuilder 实例源码

项目:javafx-demos    文件:DynamicTextAreaDemo.java   
@Override
public void start(Stage stage) throws Exception {
    this.stage = stage;
    configureScene();
    configureStage();
    // Logic starts
    VBox vb = new VBox();
    vb.setSpacing(10);

    final VBox layout = VBoxBuilder.create().build();
    layout.getChildren().add(new DynamicTextArea());

    Button btn = ButtonBuilder.create().text("Add").onAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent arg0) {
            layout.getChildren().add(new DynamicTextArea());
        }
    }).build();

    final GridPane gridPane = GridPaneBuilder.create()
            .styleClass("contact-details-gridpane")
            // [ARE] Further modification for CAEMR-2098. Setting minimum width to show labels even if application width is changed.
            .columnConstraints(ColumnConstraintsBuilder.create().hgrow(Priority.NEVER).minWidth(80).build(),
                    ColumnConstraintsBuilder.create().hgrow(Priority.ALWAYS).build(),
                    ColumnConstraintsBuilder.create().hgrow(Priority.NEVER).minWidth(100).build()).build();

    gridPane.addRow(0, new Label("hi"), layout, btn);

    root.getChildren().add(ScrollPaneBuilder.create().styleClass("contact-details-pane").hbarPolicy(ScrollBarPolicy.NEVER)
            .fitToWidth(true).content(gridPane).build());
}