How to disable scaling the UI on Windows, for Java 9 applications?

五迷三道 提交于 2019-11-30 05:28:40

问题


There was no proper HiDPI support in Java 8.

In Java 9, JavaFx applications correctly scale to the monitor they are in. For example, if my monitor is set to scale at 150%, the Java application is scaled to 150%.

See: http://openjdk.java.net/jeps/263

However, for testing purposes, I need to be able to disable scaling by using java.exe flags, in Windows 10. How can I achieve this?

Also, maybe I can disable (and re-enable) this programmatically within the application itself?


回答1:


I found this obscure option in a substance bug report. This fixes the issue for Swing applications.

-Dsun.java2d.uiScale=1.0

If you're using JavaFX you'll need

-Dprism.allowhidpi=false

Unfortunately I cannot find official documentation for either of these options



来源:https://stackoverflow.com/questions/47613006/how-to-disable-scaling-the-ui-on-windows-for-java-9-applications

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!