RFR: 8372530: Easier placement of windows with positioning anchor
Andy Goryachev
angorya at openjdk.org
Wed Dec 10 00:08:20 UTC 2025
On Tue, 9 Dec 2025 00:28:00 GMT, Michael Strauß <mstrauss at openjdk.org> wrote:
>> Is there something that prevents us to invent a new anchor type?
>
> Maybe we can specify two anchors:
>
> void Stage.relocate(AnchorPoint screenAnchor, AnchorPoint stageAnchor);
>
>
> Then, if you want to center the window on the screen, you can do:
>
> myStage.relocate(AnchorPoint.proportional(0.5, 0.5), AnchorPoint.proportional(0.5, 0.5));
> // or myStage.relocate(AnchorPoint.CENTER, AnchorPoint.CENTER);
I like it, because we can easily cover almost all the possible cases.
Should we also allow to specify the `Screen`? In a third parameter to this extended method? And if the `Screen` is `null`, the logic would use the default screen or the owner's one? What do you think?
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1986#discussion_r2603354322
More information about the openjfx-dev
mailing list