On Fri, 28 Nov 2025 00:09:26 GMT, Michael Strauß <[email protected]> wrote:

>> modules/javafx.graphics/src/main/java/javafx/stage/Stage.java line 1298:
>> 
>>> 1296:     @Override
>>> 1297:     public void centerOnScreen() {
>>> 1298:         relocationRequest = null; // cancel previous relocation 
>>> request
>> 
>> As far as I understand, with the new anchor system, a center on screen can 
>> easily be achieved as well? I wonder if we could also deprecate this method 
>> instead. But not sure if I understand it correctly.
>
> No, the anchor is always a point _on the window being shown_, not on the 
> screen. All anchor APIs require you to specify an explicit screen location, 
> and the window is then moved so that the anchor coincides with that screen 
> location. So to emulate `centerOnScreen()`, you'd have to manually get the 
> screen bounds, and then calculate the center.

Is there something that prevents us to invent a new anchor type?

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1986#discussion_r2600499939

Reply via email to