Check out example codes for "javafx get screen size". It will help you in understanding the concepts better.

Code Example 1

Rectangle2D screenBounds = Screen.getPrimary().getBounds();
System.out.println("Height: " + screenBounds.getHeight() + " Width: " + screenBounds.getWidth());

Output:
Height: 1440.0 Width: 2560.0

Learn ReactJs, React Native from akashmittal.com