RFR: 8307208: Add GridPane constructor that accepts hGap and vGap values

Nir Lisker nlisker at openjdk.org
Wed May 3 20:37:28 UTC 2023


On Wed, 3 May 2023 20:13:42 GMT, Marius Hanl <mhanl at openjdk.org> wrote:

> This PR adds a new constructor to `GridPane` that accepts a `hgap` and a `vgap`.
> As also written in the ticket, this is a small enhancement to improve the creation of a layout involving a `GridPane` without FXML.
> In my experience, the `hgap` and the `vgap` are almost always set when creating a layout with the `GridPane`, as a space between the content just looks much better.
> 
> This also fits well with other classes like `HBox` and `VBox`, which also provide a constructor that accepts the spacing.

Look simple enough. `FlowPane` and `TilePane` have this constructor as well.

modules/javafx.graphics/src/main/java/javafx/scene/layout/GridPane.java line 738:

> 736: 
> 737:     /**
> 738:      * Creates a GridPane layout with the given {@link #hgapProperty() hgap} and {@link #vgapProperty() vgap}.

"GridPane" should be in `{@code}`.

modules/javafx.graphics/src/main/java/javafx/scene/layout/GridPane.java line 741:

> 739:      *
> 740:      * @param hgap the width of the horizontal gaps between columns
> 741:      * @param vgap the height of the vertical gaps between rows

I think that either
"the width of the gaps between columns" or
"the size of the horizontal gaps between columns"
otherwise it gives the illusion that there is a height for the horizontal gap.

Still reads fine as it is.

-------------

PR Review: https://git.openjdk.org/jfx/pull/1125#pullrequestreview-1411752213
PR Review Comment: https://git.openjdk.org/jfx/pull/1125#discussion_r1184225022
PR Review Comment: https://git.openjdk.org/jfx/pull/1125#discussion_r1184229229


More information about the openjfx-dev mailing list