How to Fix Resolution Problems With High DPI Screens
Screen resolutions on PCs are getting sharp and reaching higher resolution, but developers may find it hard to work on IDEs that don't support high DPI screens.
Join the DZone community and get the full member experience.
Join For FreeScreen resolutions on PCs are getting sharp and reaching up to 4K resolution. Although they are very good for watching high-quality movies or your favorite NFL games, developers may find it hard to work on IDEs that don't support high DPI screens. Icons, fonts, control buttons, toggles, and other UI elements don't scale well and look so tiny, straining your eyes and impacting productivity.
These problems make high resolution displays unfriendly for development. Note that this might not be a problem in Macs because MacOS natively offers support scaling of your programs so that they look better regardless of high display resolutions. In Windows, individual programs should handle high DPIs by themselves.
The most popular IDEs, like Eclipse and JDeveloper, don't understand high DPI screens. You might want to wear powerful reading glasses while coding in these IDEs!
Eclipse and JDeveloper appear like in the below screenshots on high-resolution screens:
Eclipse:
JDeveloper:
When I first encountered this situation, I tried tweaking Windows' font size and display resolution, but much with despair. I also tried tweaking font sizes in Eclipse and JDeveloper, but all of my attempts made the problem worse by messing up the overall visual layouts of the IDEs. I was searching for a solution, thinking, "There has to be a way!"
Yes, indeed. Eclipse and JDeveloper use Java2D APIs, and luckily Java introduced support to high DPI a couple of years ago (but it was secretly hidden in their Bugzilla).
The magic trick is to add a VM argument to make these rich, featured IDEs beautiful again.
In Eclipse, add the following argument into your $ECLIPSE_HOME\eclipse.ini file as two separate lines:
vmargs
Dsun.java2d.dpiaware=true
Now, your eclipse.ini file should look like the picture below:
In JDeveloper, add the following line in your $JDEVELOPER_HOME\jdev\bin\jdev.conf:
AddVMOption -Dsun.java2d.dpiaware=true
Now, your jdev.conf file should look like the picture below:
After tweaking the settings with dpiaware flag, Eclipse and JDeveloper appear like below:
Eclipse:
JDeveloper:
As you notice, they look way better after applying the little dpiaware flag in startup VM arguments.
Eclipse's latest and greatest version, Neon, natively supports High DPI screens now, but not all developers may have the luxury to upgrade Eclipse in corporate settings, so you might find this tweak useful.
Enjoy coding again!
Opinions expressed by DZone contributors are their own.
Comments