I have a utility class that reloads CSS. To get all stages on the scene graph I am using
com.sun.javafx.stage.StageHelper#getStages()
In Java 9 this is no longer accessible without specifying --add-exports
during compile.
--add-exports=javafx.graphics/com.sun.javafx.stage=ALL-UNNAMED
I am looking for an alternative to StageHelper in getting all stages on the scene graph.
There is a public API equivalent to StageHelper.getStages()
in Window.getWindows()
.
However there is a slight difference between these two:
StageHelper.getStages(): Returns a ObservableList containing Stages created at this point
Window.getWindows(): Returns a list containing a reference to the currently showing JavaFX windows.
What I get from this is that using Window instead of StageHelper will not get me the Stages that are invisible/hidden.
In Java 8 Window.impl_getWindows() returned all the windows, and it says nothing of visibility.
A list of all the currently existing windows
This changed with Java 9 Window.getWindows()
A list of all the currently showing windows