# HG changeset patch # Parent c841d205183e288a18eaaa6c5128fcb424d96878 RT-16845: FlowPane doesn't subtract insets when computing wrap dimension diff --git a/javafx-ui-common/src/javafx/scene/layout/FlowPane.java b/javafx-ui-common/src/javafx/scene/layout/FlowPane.java --- a/javafx-ui-common/src/javafx/scene/layout/FlowPane.java +++ b/javafx-ui-common/src/javafx/scene/layout/FlowPane.java @@ -482,7 +482,8 @@ return getInsets().getLeft() + snapSize(getPrefWrapLength()) + getInsets().getRight(); } else { // vertical - double maxRunHeight = forHeight != -1? forHeight : getPrefWrapLength(); + double maxRunHeight = forHeight != -1? + forHeight - getInsets().getTop() - getInsets().getBottom() : getPrefWrapLength(); List vruns = getRuns(maxRunHeight); return getInsets().getLeft() + computeContentWidth(vruns) + getInsets().getRight(); } @@ -491,7 +492,8 @@ @Override protected double computePrefHeight(double forWidth) { if (getOrientation() == HORIZONTAL) { // horizontal - double maxRunWidth = forWidth != -1? forWidth : getPrefWrapLength(); + double maxRunWidth = forWidth != -1? + forWidth - getInsets().getLeft() - getInsets().getRight() : getPrefWrapLength(); List hruns = getRuns(maxRunWidth); return getInsets().getTop() + computeContentHeight(hruns) + getInsets().getBottom(); } else {