Пример #1
0
  private GridPane getNewGrid() {
    GridPane grid = new GridPane();
    grid.setVgap(10);
    grid.setHgap(5);
    // grid.setGridLinesVisible(true);
    grid.paddingProperty().set(new Insets(5));

    // GridPane.setVgrow(grid, Priority.ALWAYS);
    // grid.setMinWidth(500);

    ColumnConstraints col = new ColumnConstraints();

    col.setMinWidth(10);
    col.setHgrow(Priority.SOMETIMES);
    col.setFillWidth(true);

    // col.setPercentWidth(1);
    col.setPrefWidth(100);

    grid.getColumnConstraints().addAll(col, col);

    // ------

    RowConstraints row1 = new RowConstraints();
    RowConstraints row2 = new RowConstraints();

    row1.setMinHeight(10);
    row1.setVgrow(Priority.SOMETIMES);
    row1.setFillHeight(true);
    row1.setPrefHeight(30);

    row2.setMinHeight(10);
    row2.setVgrow(Priority.SOMETIMES);
    row2.setFillHeight(true);
    row2.setValignment(VPos.CENTER);

    grid.getRowConstraints().addAll(row1, row2);

    // ColumnConstraints c = new ColumnConstraints();
    // c.setHgrow(Priority.SOMETIMES);
    // c.setMaxWidth(173.0);
    // c.setMinWidth(10.0);
    // c.setPrefWidth(124.0);
    // grid.getColumnConstraints().add(c);

    // c = new ColumnConstraints();
    // c.setHalignment(HPos.RIGHT);
    // c.setHgrow(Priority.NEVER);
    // grid.getColumnConstraints().add(c);

    // RowConstraints r = new RowConstraints();
    // r.setVgrow(Priority.NEVER);
    // grid.getRowConstraints().add(r);

    return grid;
  }
Пример #2
0
  private final void defineStretching() {
    //////////// give resizing hints
    ObservableList<RowConstraints> rows = getRowConstraints();
    logger.info("original row constraints size" + rows.size());

    RowConstraints rc;

    rc = new RowConstraints();
    // rc.setPercentHeight( 0 );
    rc.setVgrow(Priority.NEVER);
    rc.setMinHeight(StaticConst.GU);
    rows.add(rc);
    rc = new RowConstraints();
    // rc.setPercentHeight( 100 );
    rc.setVgrow(Priority.ALWAYS);
    rows.add(rc);
    rc = new RowConstraints();
    // rc.setPercentHeight( 0 );
    rc.setVgrow(Priority.NEVER);
    rows.add(rc);

    ObservableList<ColumnConstraints> ccs = getColumnConstraints();
    logger.info("original column constraints size" + ccs.size());
    ColumnConstraints cc;

    cc = new ColumnConstraints();
    cc.setHgrow(Priority.ALWAYS);
    ccs.add(cc);
  }