JavaFX DPI Scaling Factor on Ubuntu (20.04)

JavaFX 11 has a bug that ignores the scaling factor on Gnome on Ubuntu. This results in very small windows and controls, when running JavaFX on High DPI screens.

JavaFX does try to read the scaling factor from gsettings org.gnome.desktop.interface scaling-factor. Unfortunately, this variable is set by default on Ubuntu.

In order to get high-dpi scaling in JavaFX, you need to set it manually:

gsettings set org.gnome.desktop.interface scaling-factor 2

(or whatever your desired scaling factor is).

Alternatively, you can use the environment variable GDK_SCALE to set a scaling factor.