Does Java support the retina display with high definition rendering of, for example, text? Or is it treated as an unmodified application, and therefore subject to scaling?
MacBook – Java and Mac retina support
displayjavamacbook pro
Related Question
- MacOS – Macbook Pro Retina running at native resolution
- MacBook – Other resolution (no scaling) in MacBook Pro retina
- MacOS – Is retina text in a non-retina OS X Application possible
- Retina dsiplay support on Intellj Idea for Java /JavaScript development
- MacBook – Does DevonThink Pro Office support the Macbook Pro Retina display
- MacBook Pro Retina and 4k monitor (Samsung U28D590D) now showing “scaling options” in display
- MacBook Pro Support for 3840 x 1600 (and higher) resolutions
Best Answer
I just tested this on my MacBook Pro with retina, so the answer is yes and no - at least under Mountain Lion.
If you use Java directly from the command line, the answer is yes: it will launch in HiDPI and render text in high resolution. Things rendered using Graphics2D will render in high resolution mode. (So if you render a line 0.5 AWT pixels thick and place it at 0.25/0.75 off an AWT pixel, it will render a single "retinal pixel" thick.) Likewise, rendering an image at half-resolution will render it at "retinal" resolution.
So instead of just
g.drawImage(image, x, y, observer)
you'd need to do:(Unless you have an odd width/height, in which case you should probably use Graphics2D and just
scale(0.5, 0.5)
to render a retinal image.)If you use JavaApplicationStub, then you need the answer provided by Matt Solnit, otherwise it will launch in the "scaled" mode. (Under Mountain Lion, there are added hoops to jump through related to Gatekeeper, but that's a different question.)
Note that this answer applies to both Mountain Lion and the Apple-provided version of Java for it (Java 1.6.0_33). It might be different under Oracle's Java 7 for Mac OS X, and it may not work the same way under Lion.