RFR: 8372530: Easier placement of windows with positioning anchor
Michael Strauß
mstrauss at openjdk.org
Wed Dec 10 00:08:17 UTC 2025
On Wed, 26 Nov 2025 17:48:22 GMT, Andy Goryachev <angorya at openjdk.org> wrote:
>> `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.
I've redesigned the feature a bit, and found that we can indeed make this compatible with `PopupWindow`. You now have the option to specify `PopupWindow.anchorPolicy`, which defaults to the current behavior, but can also be specified to work as you describe (using `AnchorPolicy.AUTO`).
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1986#discussion_r2570059453
More information about the openjfx-dev
mailing list