Page 1 of 1

JavaFX app screen origin being moved on load

Posted: Fri Aug 14, 2020 5:01 pm
by JimBurke
We are currently working on a JavaFX app that will be loaded onto a Pi, the Pi is running Debian Linux.

We have an issue whereby when the app loads it appears that the origin of the application is being moved, something around -12px up and maybe -2px to the left. Assuming the origin 0,0 is screen top left, it appears that this is being modified to -2, -12 !

We have added a splash screen to the application (Pink Rectangle with Green borders). This is also part of the same app (built with NetBeans). As you can see with the images below, when the splash loads up, it fits to the window perfectly (800x480), but then when the actual app screens come in they are being moved.

For reference, the FXML files are being styled etc in SceneBuilder.
  • Raspberry Pi model 3B+
    Touch Screen (7") - official Rasp Pi from OKDO - uses DSI not HDMI
    Debian (Build Buster)
    JavaFX (most recent version)
    SceneBuilder (...)
    NetBeans IDE (...)
This image shows the bottom and right borders. This is effectively the pink splash screen showing through.
Image

Any help on this is appreciated!

Jim Burke

Re: JavaFX app screen origin being moved on load

Posted: Sun Aug 16, 2020 12:25 pm
by JimBurke
We seem to have fixed it, although I suspect there's more to this.
The fix was when loading the scene ...

primaryStage.setScene(scene);

primaryStage.setX(0); // For some reason we absolutely need these. If we use 800x480
primaryStage.setY(0); // (ie. screen res) then we get a 2-pix border on right and 15 pix
primaryStage.setWidth(802) ; // border on bottom. !!!!!!!!!!!!! WTF !!!!!!!!!!!!!!!!!!!!!
primaryStage.setHeight(509) ; // Setting the origin at 0,0 is also essential ! Work that out.

primaryStage.show();