On Mon, 3 Aug 2026 21:12:40 GMT, Andy Goryachev <[email protected]> wrote:
> Not a review (yet), but a question: would it be better to include two panes
> instead of one, to gauge the amount of common code?
>
> The `BorderPane` perhaps?
I checked out `BorderPane` -- it is a bit more complicated than `StackPane` and
would also require moving more code from `Region` to `LayoutSupport` making the
review a bit harder. Perhaps exclude it for now? I don't mind making another PR
later with support for it.
The API for `BorderPaneLayout` would look similar to `StackPaneLayout` except
that instead of a `setChildren` you would have a method like this:
void setPositions(Layoutable center, Layoutable top, Layoutable right,
Layoutable bottom, Layoutable left) {
this.center = center;
this.top = top;
this.right = right;
this.bottom = bottom;
this.left = left;
invalidate();
}
Any positions that are not occupied (or are not for managed children as layouts
don't deal with those) should be set to `null`. So `BorderPane` would do
something like:
private void syncLayout() {
if (layoutSynced) {
return;
}
borderPaneLayout.setPositions(
managedOrNull(getCenter()),
managedOrNull(getTop()),
managedOrNull(getRight()),
managedOrNull(getBottom()),
managedOrNull(getLeft())
);
borderPaneLayout.setInsets(getInsets());
borderPaneLayout.setSnapToPixel(isSnapToPixel());
borderPaneLayout.setRenderScaleContext(renderScaleContext());
layoutSynced = true;
}
-------------
PR Comment: https://git.openjdk.org/jfx/pull/2241#issuecomment-5194234348