Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8307454

Add GridPane constructor that accepts hGap and vGap values

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • jfx21
    • javafx
    • None
    • source
    • minimal
    • Minimal risk since this only adds a new constructor. The default constructor still exists and can be used as before.
    • Java API
    • JDK

      Summary

      Add a new constructor to GridPane which accepts a hgap and vgap value.

      Problem

      GridPane is a layout container that is widely used because of its flexibility and constraints. When creating a layout without the use of FXML, one needs to create a GridPane and set everything in code. The hgap and vgap values are almost always set after the creation of the GridPane, as a space between the content is usually desired.

      Solution

      Add new constructor to the GridPane class which accepts a hgap and vgap value. This also fits well with other layout container like HBox, VBox and FlowPane which also provide a constructor that accepts the spacing.

      Specification

      /**
       * Creates a {@code GridPane} layout with the given {@link #hgapProperty() hgap} and {@link #vgapProperty() vgap}.
       *
       * @param hgap the size of the horizontal gaps between columns
       * @param vgap the size of the vertical gaps between rows
       *
       * @since 21
       */
       public GridPane(double hgap, double vgap) {
           ...
       }

            mhanl Marius Hanl
            webbuggrp Webbug Group
            Kevin Rushforth
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: