Java – how do I scale fonts on a high resolution screen?
On the high resolution screen (my example, windows 8.1) is my java application In particular, the menu is so small that it is almost impossible to select menu items
In the normal screen (72 DPI), everything is normal
Having a fixed size font (in my case, it will have < 80px) is a bad choice The 72 DPI screen shows that it is very large How can I make fonts extensible so that programs fit their size, or can users set them?
Solution
You can change the default font size in one place by accessing your plaf:
However, this still makes the application look bad because the space between components will be in pixels and will not scale with the font size See http://www.javalobby.org/java/forums/t101878.html Have a longer discussion
My suggestion is to use a DPI supported layout library, such as miglayout, which supports the identification of mm or cm size in pixels or dpi You can then use fontmetrics to couple font scaling with DPI aware spacing to find the correct font size