<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<div dir="ltr" style="font-family: "Iosevka Fixed SS16", Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
+1 for Dialog and centerOnScreen (or make it as another option in AnchorPoint or ClampPolicy?)</div>
<div dir="ltr" style="font-family: "Iosevka Fixed SS16", Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div dir="ltr" style="font-family: "Iosevka Fixed SS16", Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
-andy</div>
<div dir="ltr" style="font-family: "Iosevka Fixed SS16", Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div id="mail-editor-reference-message-container">
<div dir="ltr" class="ms-outlook-mobile-reference-message skipProofing"></div>
<div class="ms-outlook-mobile-reference-message skipProofing" style="text-align: left; padding: 3pt 0in 0in; border-width: 1pt medium medium; border-style: solid none none; border-color: rgb(181, 196, 223) currentcolor currentcolor; font-family: Aptos; font-size: 12pt; color: black;">
<b>From: </b>openjfx-dev <openjfx-dev-retn@openjdk.org> on behalf of Marius Hanl <mariushanl@web.de><br>
<b>Date: </b>Wednesday, November 26, 2025 at 05:37<br>
<b>To: </b>michaelstrau2@gmail.com <michaelstrau2@gmail.com>, openjfx-dev@openjdk.org <openjfx-dev@openjdk.org><br>
<b>Subject: </b>Re: Easier placement of stages with positioning anchor<br>
<br>
</div>
<div class="ms-outlook-mobile-reference-message skipProofing" style="font-family: verdana; font-size: 12px; color: rgb(0, 0, 0);">
<span style="background-color: rgb(255, 255, 255);">I like this idea. Especially since there is not much control right now.</span></div>
<div class="ms-outlook-mobile-reference-message skipProofing" style="font-family: verdana; font-size: 12px; color: rgb(0, 0, 0);">
<span style="background-color: rgb(255, 255, 255);">For reference, what I normally do to make sure that a Dialog can not exceed the bounds is:</span></div>
<div class="ms-outlook-mobile-reference-message skipProofing" style="font-family: verdana; font-size: 12px; color: rgb(0, 0, 0);">
<span style="background-color: rgb(255, 255, 255);"> </span></div>
<div class="ms-outlook-mobile-reference-message skipProofing" style="font-family: verdana; font-size: 12px; color: rgb(0, 0, 0);">
<span style="background-color: rgb(255, 255, 255);">dialog.setOnShown(_ -> Platform.runLater(() -> resizeRelocateDialogIfBoundsExceedsScreen(dialog)));</span></div>
<div class="ms-outlook-mobile-reference-message skipProofing" style="font-family: verdana; font-size: 12px; color: rgb(0, 0, 0);">
<span style="background-color: rgb(255, 255, 255);"> </span></div>
<div class="ms-outlook-mobile-reference-message skipProofing" style="font-family: verdana; font-size: 12px; color: rgb(0, 0, 0);">
<span style="background-color: rgb(255, 255, 255);">Which is a bit hacky, and I need to do the calculation by myself. Example of a part of that method:</span></div>
<div class="ms-outlook-mobile-reference-message skipProofing" style="font-family: verdana; font-size: 12px; color: rgb(0, 0, 0);">
<span style="background-color: rgb(255, 255, 255);"> </span></div>
<div class="ms-outlook-mobile-reference-message skipProofing" style="font-family: verdana; font-size: 12px; color: rgb(0, 0, 0);">
    private static void relocateDialog(Dialog<?> dialog, Rectangle2D screenBounds) {<br>
        // If the dialog exceeds the screen to the right<br>
        if (dialog.getX() + dialog.getWidth() > screenBounds.getMaxX()) {<br>
            dialog.setX(screenBounds.getMaxX() - dialog.getWidth() - SCREEN_EDGE_SPACING);<br>
        }<br>
        if (dialog.getY() + dialog.getHeight() > screenBounds.getMaxY()) {<br>
            dialog.setY(screenBounds.getMaxY() - dialog.getHeight() - SCREEN_EDGE_SPACING);<br>
        }</div>
<div class="ms-outlook-mobile-reference-message skipProofing" style="font-family: verdana; font-size: 12px; color: rgb(0, 0, 0);">
        // If the dialog exceeds the screen to the left<br>
        if (dialog.getX() < screenBounds.getMinX()) {<br>
            dialog.setX(screenBounds.getMinX() + SCREEN_EDGE_SPACING);<br>
        }<br>
        if (dialog.getY() < screenBounds.getMinY()) {<br>
            dialog.setY(screenBounds.getMinY() + SCREEN_EDGE_SPACING);<br>
        }<br>
    }</div>
<div class="ms-outlook-mobile-reference-message skipProofing" style="font-family: verdana; font-size: 12px; color: rgb(0, 0, 0);">
 </div>
<div class="ms-outlook-mobile-reference-message skipProofing" style="font-family: verdana; font-size: 12px; color: rgb(0, 0, 0);">
Since a Dialog uses a Stage, your Anchor API could also be used there (and in the future, integrated into Dialog, which is delegating to the showAndWait(..) method of the Stage)?<br>
That would be helpful, and a usecase I often had.</div>
<div class="ms-outlook-mobile-reference-message skipProofing" style="font-family: verdana; font-size: 12px; color: rgb(0, 0, 0);">
 </div>
<div class="ms-outlook-mobile-reference-message skipProofing" style="font-family: verdana; font-size: 12px; color: rgb(0, 0, 0);">
I also wonder if we want to retrofit that into the centerOnScreen() method (in the future?). <br>
So that this method will use (set) the underlying Anchor System now instead. So we have only one way to position a Stage.</div>
<div class="ms-outlook-mobile-reference-message skipProofing" style="font-family: verdana; font-size: 12px; color: rgb(0, 0, 0);">
 </div>
<div class="ms-outlook-mobile-reference-message skipProofing" style="font-family: verdana; font-size: 12px; color: rgb(0, 0, 0);">
-- Marius</div>
<div class="ms-outlook-mobile-reference-message skipProofing" style="font-family: verdana; font-size: 12px; color: rgb(0, 0, 0);">
 </div>
<div id="sub-body-container" style="margin:10px 5px 5px 10px; padding:10px 0px 10px 10px; border-left:2px solid rgb(195,217,229)">
<div style="margin: 0px 0px 10px;">
<div><b>Gesendet: </b>Dienstag, 25. November 2025 um 20:04</div>
<div><b>Von: </b>"Michael Strauß" <michaelstrau2@gmail.com></div>
<div><b>An: </b>openjfx-dev <openjfx-dev@openjdk.org></div>
<div><b>Betreff: </b>Easier placement of stages with positioning anchor</div>
</div>
I've prepared a small enhancement for Stage that allows applications<br>
to show a stage relative to a reference point, similar to how popups<br>
work. This is a useful addition for a potential system tray support<br>
(where windows are often placed relative to a system tray icon), but<br>
also comes in handy for multi-window applications.<br>
<br>
Comments are welcome.<br>
<br>
PR: <a href="https://github.com/openjdk/jfx/pull/1986" target="_blank" rel="noopener noreferrer" data-outlook-id="c9913bf6-b73f-4307-90be-12cae456cf35">
https://github.com/openjdk/jfx/pull/1986</a></div>
</div>
</body>
</html>