Over a million developers have joined DZone.

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.

· Integration Zone

Is iPaaS solving the right problems? Not knowing the fundamental difference between iPaaS and dPaaS could cost you down the road. Brought to you in partnership with Liaison Technologies.

Screen 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:

Image title

JDeveloper:

Image title

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:

Image title

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:

Image title

After tweaking the settings with dpiaware flag, Eclipse and JDeveloper appear like below:

Eclipse:

Image title

JDeveloper:

Image title

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!

Discover the unprecedented possibilities and challenges, created by today’s fast paced data climate and why your current integration solution is not enough, brought to you in partnership with Liaison Technologies.

Topics:
ide ,dpi ,integration ,eclipse ,jdeveloper

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}