While computing a screen’s user interface scale the Linux code consults the “scaling-factor” gsetting in the “org.gnome.desktop.interface” schema. This check was added about eight years ago in the PR that addressed JDK-8166382. On the Ubuntu systems I’m familiar with this value is not set so JavaFX computes the scaling factor based on the monitor resolution reported by GDK. This technique allows JavaFX to support fractional scaling.
As of June 2023 (version 5.27.80 or so) KDE started setting the scaling-factor. Originally this was set by flooring the real scaling factor but in an upcoming version they will round upward in some cases. According to the commit comment this was to get IntelliJ IDEA to behave better. In any case KDE is now setting this and if the system scale is fractional it’s guaranteed to be wrong. See https://invent.kde.org/plasma/kde-gtk-config/-/commit/b79bd5a95d8fe9964fa695edbed1180f72ca8b69.
KDE also adds the scaling factor to Xsettingsd as “Gdk/WindowScalingFactor”. That started about a year ago but it is also a floored integer. See https://invent.kde.org/plasma/kde-gtk-config/-/commit/1debd2e0833fd62e2e1c1837387fcc1c3436340a.
I suspect the org.gnome.desktop.interface scaling-factor setting is obsolete since it only handles integral scaling. JavaFX should probably stop consulting it.