Support high-density screens

Issue #136 new
Mikhail Lopatkin repo owner created an issue

On 4K displays (e.g. 15" 3840*2160) the app window is too small. It needs to support default platform scaling.

I've tested on Linux (Ubuntu 16.04.1) only, because I don't have Win/Mac device with 4K display yet.

Comments (7)

  1. Mikhail Lopatkin reporter

    The workaround that I use now is to run the app with JDK 11. Support for HiDPI in Swing was added in JDK 10, now it respects system-wide scaling. However, Android developers often stuck on JDK 8 so some solution is needed here:

    • add command-line key to scale manually?
    • ship embedded JDK 11 with the app with javapackager or alike?

  2. Mikhail Lopatkin reporter

    Another workaround (on Windows) is to use JDK bundled with Android Studio (aka JetBrains Runtime). One needs to point JAVA_HOME to the Studio's JDK and set LOGVIEW_OPTS=-Dsun.java2d.uiScale.enabled=true in environment.

  3. Mikhail Lopatkin reporter

    It looks like the Linux situation is more broken than I thought. I've failed to set up 1.5 scaling on Ubuntu 16.04 with JDK 11. The same configuration seems to works on my desktop though (I need to re-check). Setting 2x scaling with GDK_SCALE=2 or -Dsun.java2d.uiScale.enabled=true works though.

  4. Mikhail Lopatkin reporter

    Fractional scaling is not supported by Jetbrains Runtime as well: https://youtrack.jetbrains.com/issue/JBR-1365

    Not so many options left: 1. Manual scaling everywhere (moderately difficult) 2. Check if JavaFX supports fractional scaling and rewrite UI in JavaFX (checking is easy, rewriting is hard however beneficial to code health and my knowledge of JavaFX :)) 3. Check if SWT supports fractional scaling and rewrite UI in SWT (again, checking is easy, rewriting is hard and I'm not sure SWT is a feasible choice).

  5. Mikhail Lopatkin reporter

    JPackage is going to hit stable in Java 16. I should probably bundle the runtime with the app so users with HiDPI displays don't have to set up a separate JDK.

  6. Log in to comment