24

I just became aware that AWT / Swing under Java JDK 1.7 (as of JDK 7u15) does not support Retina displays on Apple Macbook Pros. Netbeans, for example, is nearly unbearable to use for more than a few minutes running on a Retina display and using JDK 1.7.

This has been somewhat addressed in a StackExchange question here, and quoting one specific post:

Apple's Java 6 JRE will support HiDPI, however it is not currently supported by Oracle's Java 7 JRE. It also doesn't work under the latest dev builds of Java 8. Swing and JavaFX apps are blurry on a Retinia MacBook. This is why IntelliJ still runs under Java 6.

My question is more specific than what is asked by the OP of the above thread.

My employer of less than a month uses Swing in all of its applications. For several reasons we are interested in migrating to Java 7 from Java 6. Within the last several days, another developer (who is on Windows), moved our platform over to Java 7. As I'm running a retina Macbook Pro, I noticed the issue when I pulled the latest stable branch of our code.

I am new to Java with less than a year of experience in the community, hence my question: Will the Java community be fairly responsive to this issue moving forward, or should a substantial delay be anticipated (months to a year or more) before Swing in Java 7 is compatible with Apple Retina displays?

Community
  • 1
  • 1
kalefranz
  • 4,612
  • 2
  • 27
  • 42

4 Answers4

19

Java 7u40 Early Access now supports HiDPI (Retina) displays, as shown by this changelog. So retina support is now available on:

  • Java 6
  • Java 7u40ea or greater
  • Java 8
Thunderforge
  • 19,637
  • 18
  • 83
  • 130
  • Thanks, that sorts out Swing (using Java7u40ea). Doesn't seem to help with JavaFX, though - I get nice sharp Swing windows and fuzzy JavaFX ones. – mo-seph Aug 27 '13 at 14:25
  • Actually, it seems to work for JavaFX as well. Now everything is nice and sharp. Fantastic! – mo-seph Aug 27 '13 at 14:45
7

last month I was also interested in the same topic and after some time I found out on net that nobody can answer the question exactly.

There is an open bug for this at Oracle: http://bugs.sun.com/view_bug.do?bug_id=8000629

According to that it should be fixed for Java 1.8. But what I am afraid of is that I am not sure if it also will be fixed for Swing or only for JavaFX. I read somewhere that there is already fix for JavaFX (but not sure if official), which doesn't solve the problem for Swing.

To answer short, after some days of searching on internet unfortunately I couldn't find the answer ...

Regards, Lubos

Lubos
  • 1,169
  • 10
  • 19
  • no hard info, just guessing: the sub-component that bug is issued against is java.awt - if that will stand, it's likely to get fixed against the old graphics. – kleopatra Mar 11 '13 at 12:25
  • true, but I meant nobody can say for sure that bug will be really fixed. I couldn't find on internet any info at least that the work already started - and Java 8 should be released in September. – Lubos Mar 11 '13 at 12:44
  • 2
    A fix has now been created for Java 8 and should be officially implemented soon: http://mail.openjdk.java.net/pipermail/macosx-port-dev/2013-April/005491.html . I'm not sure if there are plans to backport it to Java 7. – Thunderforge Apr 07 '13 at 22:37
  • 3
    Someone from Oracle just commented today that it will be backported to Java 7: http://mail.openjdk.java.net/pipermail/macosx-port-dev/2013-April/005508.html – Sean Reilly Apr 08 '13 at 23:28
  • Thanks @Thunderforge and SeanReilly for the info. Very helpful. – kalefranz Apr 09 '13 at 18:38
  • Using the latest preview build of JDK8, it now finally works! Swing renders crisp sharp and images can be rendered in double size as well, that means retina applications using Apple 1.6 JDK are compatible. You can find it under "Java Early Access Downloads" https://jdk8.java.net/download.html – IsNull May 02 '13 at 16:57
6

Retina is fully supported by Oracle starting 1.7.0_40ea. However, there are lacks of APIs for Retina. For instance, there is no support for HiDPIScaledImages like in Apple JDK. You can find some cool tips about Retina support in Oracle JDK here http://bulenkov.com/2013/06/23/retina-support-in-oracle-jdk-1-7/

2

According to a long thread that I read some months ago (http://lists.apple.com/archives/java-dev/2012/Oct/msg00127.html) the only way to get Retina in Swing is to install the Apple JDK, which in turn just uses a "hack" to make applications retina-compatible. That thread mentions JavaFX as a workaround (which of course is no real workaround when you already have a complex piece of software written in Swing).

I myself tried to write a simple JavaFX application with Java 7 after reading the above thread and it looked sharper on Retina; same with Ensamble (the JavaFX demo application, available on the App Store) which also seemed to render a lot nicer than a normal Swing application (like the Java Control Panel) but perhaps it's just the power of suggestion.

Since I am actively testing each new Java 8 Snapshot release I can also confirm that little to no work has been done to get Swing look passable on retina displays.

Our best bet right now (just an opinion, don't have any secret knowledge) is that someone at Oracle (or a OpenJDK contributor) will buy a retina mac and fix it in Java 8. I don't think Apple will fix it by supplying the Java 6 fixes since the guy from Apple said that they just reverted code related to rendering back to Quartz. It did give the desired result but is heavily tied to proprietary OS X internals which are not being open sourced.

SiCN
  • 1,052
  • 8
  • 17
  • Thanks for the link. After reading through the thread and all the links contained therein, I am nothing but discouraged :( It seems like for embedded client applications, Java developers who are (1) currently using Swing and JRE 6, (2) want to migrate beyond JRE 6, and (3) care about the presentation of their app on hiDPI displays, have no choice but to make a hard break with Swing. I took a look at Ensemble (https://itunes.apple.com/us/app/ensemble/id557744983?mt=12) which is a JavaFX demo app, and I agree that JavaFX looks _better_. It's still not Retina crisp. – kalefranz Mar 29 '13 at 12:34