On Sun, 9 Aug 2026 02:26:47 GMT, Nir Lisker <[email protected]> wrote:

>> John Hendrikx has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   Address some review comments
>
> modules/javafx.graphics/src/main/java/javafx/scene/layout/Layoutable.java 
> line 125:
> 
>> 123:         resize(width, height);
>> 124:         relocate(x,y);
>> 125:     }
> 
> Is there a reason to override this? This looks more like a convenience method 
> that would have otherwise be `final`.

Yes, there is a reason you may want to override this. While for `Node`s you 
don't need to as relocate doesn't require children traversal (a `Node` just 
sets its layout translation which applies to all its children) -- non-Node 
layoutables however don't have a layout translation, and so relocate must 
change the positions of all its children to match the passed in position.

For this reason you may want to override `resizeRelocate` to make this updating 
of children one pass instead of two passes (ie. resize first adjusting all 
children, then relocate adjusting all children again).

See how this is done in `StackPaneLayout`.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/2241#discussion_r3743379920

Reply via email to