On Tue, 9 Dec 2025 16:13:08 GMT, Andy Goryachev <[email protected]> wrote:
>> 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? I've added another overload that accepts a `Screen`. The overloads _without_ the screen parameter will always refer to the _current_ screen. This allows users to relocate a stage on its current screen as if it was the primary screen (i.e. with `(0, 0)` being the top-left corner). ------------- PR Review Comment: https://git.openjdk.org/jfx/pull/1986#discussion_r2604705791
