Only a few lines of code need to be changed. The glitch is caused by a bug, otherwise Java has already had perfect HiDPI support. See PR #62.