How can I scale fonts on a high resolution screen?

此生再无相见时 提交于 2019-12-05 06:32:05
tucuxi

You can change the default font size in a single place by accessing your PLAF: Java Swing on high-DPI screen

but this will still make the application look bad, because inter-component spaces will be in pixels, and therefore will not scale with font size. See http://www.javalobby.org/java/forums/t101878.html for a longer discussion.

My recommendation is to use a DPI-aware layout library, such as MigLayout, which supports specifying sizes either in pixels or in DPI-aware mm or cm. You can then couple both font-scaling and DPI-aware spacing by using FontMetrics to find the correct size for your fonts.

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