RFR: 8372530: Easier placement of windows with positioning anchor

Andy Goryachev angorya at openjdk.org
Wed Dec 10 00:08:16 UTC 2025


On Wed, 26 Nov 2025 16:23:14 GMT, Michael Strauß <mstrauss at openjdk.org> wrote:

>> modules/javafx.graphics/src/main/java/javafx/stage/Stage.java line 325:
>> 
>>> 323:      * @since 26
>>> 324:      */
>>> 325:     public final void show(double anchorX, double anchorY, AnchorPoint anchor) {
>> 
>> would it make more sense to move these new methods to `Window`, so they can also work for the `Popup` and its hierarchy ?
>
> `PopupWindow` works differently, it has a `anchorLocation` property which is a bit limited. We also couldn't move `PopupWindow.AnchorLocation` anywhere else (as this would be a breaking change), which would make the signature of the show() method very awkward: On `Stage.show(x, y, PopupWindow.AnchorLocation)` you'd have a parameter that is declared on an unrelated class.

Yeah, this is unfortunate.
Can we do anything to make the positioning of Popups and its hierarchy easier?  Maybe add another `show()` with a `ClampPolicy` argument?

Use case: I want to open a PopupWindow below the owner node, but: if the popup cannot be placed there because the whole thing is too close to the bottom of the screen, I want the popup to be **above** the node, and not on top of it as it works currently.

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

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


More information about the openjfx-dev mailing list