How to determine stage decoration insets before showing stage?

Tobias Oelgarte tobias.oelgarte at gmail.com
Wed Jul 27 12:57:44 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 _after_ calling Stage.show(), and 
position it with Stage.setXY(), 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.




More information about the openjfx-dev mailing list