Yes, it works. Thank you Kevin.
The used JDK is:
java version "10.0.2" 2018-07-17
Java(TM) SE Runtime Environment 18.3 (build 10.0.2+13)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.2+13, mixed mode)
Here is the code:
Scene scene = new Scene(gridPane);
scene.snapshot(null);
In general, this is fragile and should not be relied upon (not to
mention it is internal API that is not available in the latest release
and is subject to change in 8u).
One possibility using public API is to use Scene::snapshot, but even
that isn't guaranteed to work in all cases if the Scene
The GridPane is not empty:
gridPane.add(sceneTitleHBox, 0, 0, 2, 1);
Label usernameLabel = new Label("Username:");
gridPane.add(usernameLabel, 0, 1);
TextField usernameText = new TextField();
gridPane.add(usernameText, 1, 1);
Label passwordLabel = n
For Button this works. For GridPane doesn't works:
gridPane.applyCss();
gridPane.layout();
double width = gridPane.getWidth();
double height = gridPane.getHeight();
System.out.println("width=" + width + ", height=" + height);
--- exec-maven-plugin:1.5.0:exec