ADDITIONAL SYSTEM INFORMATION :
System is Windows 10.
OpenJDK 64-Bit Server VM Corretto-11.0.3.7.1 (build 11.0.3+7-LTS, mixed mode)
JavaFX 12.0.1
A DESCRIPTION OF THE PROBLEM :
NPE happens when restoring Java FX window
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
open the Java FX application
save window size + position on close using
stage.getX()
stage.getY()
stage.getWidth()
stage.getHeight()
restart and apply the prev values
stage.setX(x);
stage.setY(y);
stage.setWidth(w);
stage.setHeight(h);
When calling stage.show() afterwards I MAY get the following NPE. I can avoid it by making the
x value smaller. Values like these will cause the NPE:
X = 3112.0
Y = 941.0
W = 1932.0
H = 1165.0
System has 3 monitors.
Left: 1920x1200 in portrait
center: 3840x2160
right: 1920x1200 in portrait
Windows scaling is at 100% default.
Same NPE happens on other users' 4-monitor systems all in landscape (2x2 layout)
`javafx.fxml.LoadException:
/C:/java/viewer/fxml/viewer.fxml
at javafx.fxml/javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2625)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2603)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2466)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3237)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3194)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3163)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3136)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3113)
at javafx.fxml/javafx.fxml.FXMLLoader.load(FXMLLoader.java:3106)
at viewer.Main.start(Main.java:68)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.NullPointerException
at javafx.graphics/com.sun.glass.ui.win.WinWindow.notifyMoving(WinWindow.java:205)
at javafx.graphics/com.sun.glass.ui.win.WinWindow.setBounds(WinWindow.java:129)
at javafx.graphics/com.sun.javafx.tk.quantum.WindowStage.setBounds(WindowStage.java:336)
at javafx.graphics/javafx.stage.Window$TKBoundsConfigurator.apply(Window.java:1550)
at javafx.graphics/javafx.stage.Window.applyBounds(Window.java:1412)
at javafx.graphics/javafx.stage.Window$12.invalidated(Window.java:1117)
at javafx.base/javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:110)
at javafx.base/javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:145)
at javafx.graphics/javafx.stage.Window.setShowing(Window.java:1174)
at javafx.graphics/javafx.stage.Window.show(Window.java:1189)
at javafx.graphics/javafx.stage.Stage.show(Stage.java:273)
at viewer.ViewSwitcher.applyAndShowStage(ViewSwitcher.java:110)
at viewer.GuiController.initialize(GuiController.java:924)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2573)
... 17 more
Main: loaded
Jun 04, 2019 5:14:17 PM viewer.Main start
SEVERE: null
java.lang.NullPointerException: Root cannot be null
at javafx.graphics/javafx.scene.Scene.(Scene.java:345)
at javafx.graphics/javafx.scene.Scene.(Scene.java:207)
at viewer.Main.start(Main.java:73)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
at java.base/java.lang.Thread.run(Thread.java:834)`
---------- BEGIN SOURCE ----------
https://github.com/javafxports/openjdk-jfx/files/3298511/viewer.zip
---------- END SOURCE ----------
FREQUENCY : always