How to determine stage decoration insets before showing stage?

Tobias Oelgarte tobias.oelgarte at gmail.com
Wed Jul 27 10:04:37 UTC 2022


I have the problem that a Stage needs to be positioned precisely, while 
keeping the native window decorations. This should be a trivial task, 
but I can't find a way to determine the decoration thickness (window 
insets) prior to showing the stage.

I can determine the decoration insets and position the stage _after_ 
calling Stage.show(), but this leads to artifacts caused by canceled 
window animations (jumping window).

In Swing I can simply use JFrame.getInsets() to get the decoration 
thickness, compute the preferred size of the content and position the 
frame correctly before showing it.

How can this be done with JavaFx?

PS: I looked up various 'solutions', but all came down to either use own 
decorations, showing the stage first or to assume a fixed decoration 
thickness.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2685 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20220727/b5322c19/smime.p7s>


More information about the openjfx-dev mailing list