This will supposedly be fixed for Linux and Windows in Java9. It shouldn't require any code changes. For more information go to
http://openjdk.java.net/projects/jdk9/ scroll down and click on "263: HiDPI Graphics on Windows and Linux". Early access builds are available at
http://jdk9.java.net/ though I haven't tried them.
Supposedly it already works in MacOS.