Thursday, August 04, 2005

Java 6 and one area where Eclipse is better than NetBeans

After reading the latest status report on Java 6 (Mustang) I downloaded and installed the latest Java 6 drop (build 45). I then ran some quick and dirty tests to check out some of the improvements mentioned in the status report. Note that I'm running both versions of Java under Windows XP SP2 on a Gateway M680 with a 17" LCD screen.
Feature: Improve Windows Look and Feel
Bug IDs: 5106661
Status: 5106661 integrated into b14, remaining work ongoing
The look and feel is indeed looking better. The following screenshot shows SwingSet under 5 on the left and SwingSet under 6 on the right. The look under Swing 6 uses the same windows widgets you see in Window's File Explorer.

Feature: Improved text quality and capabilities
Bug IDs: 4502804, 5057760, 4871297, 4726365
Delivered: b39
This feature has indeed been delivered. The following is a comparison between two samples of source code in the SwingSet demo app. The difference between the selection of the fonts as well as their rendering is the difference between night and day. It's unbelievable the improvement in overall quality. Again, SwingSet under Java 5 is on the left and under Java 6 is on the right.

Time and schedule permitting I'll look at other features mentioned in the Java 6 update.

Comparison: Eclipse text rendering vs. NetBeans text rendering

When I was ranting yesterday about NetBeans and Eclipse, I overlooked the most fundamental and important difference between the two IDEs: text rendering, especially in an editor pane. Rather than talk about it, look at the following screen captures where the same source file in both IDEs are shown side-by-side. NetBeans 4.1 is on the left and Eclipse 3.1 is on the right.

As far as I'm concerned the difference is crystal clear. Regardless of the warts and limitations I'd rather work with Eclipse, especially on Windows XP running on a notebook like the Gateway with ClearType technology. I tried to run NetBeans with Java 6 by changing NetBeans netbeans.conf netbeans_jdkhome property to point to my installation of Java 6, just to see if NetBeans 4.1 would benefit from Java 6's new text improvements. It does not, at least with the text editor. But it does take advantage of Java 6's text improvements in some odd places. Take a look at the following image, for example.

Look at the right side of the Properties pane and see the difference between text on the right vs. text on the left. The text on the right is much clearer. Text in the editor did not show any benefits, and looked just as bad as it does in the earlier side-by-side comparison with Eclipse.

One "Clear" Area of Superiority

I've always felt uncomfortable about SWT because I cut my user interface teeth on Java using JFC. But in this particular instance SWT is head and shoulders above Java because SWT is a wrapper around the underlying operating system's (Windows in this case) text rendering engine. Applications written to use SWT benefit from many of the Windows UI features that native Windows applications do. I have poor eyesight, and I do suffer from eye strain and headaches from long sessions in front monitors reading and working with lots of text. Working with the latest versions of Windows in front of LCD screens is a lot easier for me than stock CRTs or other operating systems that don't have the equivalent text rendering technology. The only exception to this that I've seen to date is Mac OS X.

The Future of NetBeans and Java 6

Reading the Mustang status report, this caught my eye:
Feature: New Examples
Bug IDs: 6246816, 6246820, 4989244
Status: In development
Description: Swing's current examples do not illustrate best practices and are not representative of real applications. With that in mind, we plan on providing two distinct types of examples. One shows all the widgets in all possible states. SwingSet2 currently serves this purpose but has grown stale and out-of-date. The second example type is one that better matches a real-world application, showing best practices in using the toolkit.
Let me make a suggestion to both the NetBeans 4.2 development team and the Java 6 development team. Work together so that NetBeans becomes the second example mentioned above, showing best practices in using the JFC toolkit. Both Java and NetBeans would benefit from the combined effort. And NetBeans will certainly benefit from better use of Java 6's text rendering improvements. When NetBeans text editors look every bit as good as Eclipse's, especially on LCD screens (which are the future) then NetBeans will truly stand shoulder-to-shoulder with Eclipse where it matters most.


  1. A good idea, though I think they may be ahead of you on this. I heard netbeans was being used as a test bed for several of the bits and pieces in mustang.

    As to the side-by-side comparison of text rendering: perhaps I'm a bit young and my eyes too good, perhaps the display on the laptop I'm working on doesn't emphasize the difference properly, but I just don't see it.

  2. >> but I just don't see it.

    The problem is that blogspot converted my very clear PNGs into very blurry jpegs. I'll need to try this again over the weekend with a different set of images *sigh*

  3. This is interesting because this has always been one of the reasons why I considered SWT so much better that Swing, the font rendering.

    I was also curious about the improvements that Java 6 would bring in this respect and I did pretty much the same experiment you did.

    I had to change a setting to enable text anti-aliasing in the Netbeans editor[1]. I wonder if you did the same?

    [1] Go to Options --> Editing --> Editor Settings. Then on the right pane under the Expert heading check "Text Antialiasing".

  4. I think before posting trollish stuff in forums like I would inform myself.

    NetBeans does not work out of the box with Mustang's new font-rendering, since they set some own properties which override the SubPixel-AA property. There are already builds available which support mustang.

    Btw. if you've ever worked with Eclipse on other operating systems than windows you would know why SWT is a rather bad idea. I have to use Eclipse on GTK and its ugly and slow.

  5. >> I have to use Eclipse on GTK and its ugly and slow.

    GTK is ugly to begin with. As far as using Eclipse on Linux is concerned (and I'm assuming you are talking about Linux) I've used both NetBeans and Eclipse on Fedora Core 3, Fedora Core 4, and Ubuntu 5.04 with Java 5 and they perform equally (fast or slow, it's your call).

  6. I agree with some other commenters that mentioned that you should turn on/use AA in Netbeans before jumping to any conclusions.

    I also agree with the Javalobby guy about SWT on platforms other than Windows. It's broken on Mac OS X, and sub-par on Linux. SWT is okay if you're targeting Windows-only and don't care that much about cross-platform. If you're at all interested in good cross-platform apps, then Swing is the way to go.

  7. Nice article Bill. I don't see what people are complaining about because you clearly state that you're using the production versions and that you feel like the situation will improve on the NB side. Besides, most of the article wasn't about NB or Eclipse anyway, but that seems to have touched a sensitive spot.

  8. GTK is a widget API that has little to do with whether something is ugly. Your *theme* may be ugly but GTK isn't.

    Like it or not, Swing is using native rendering in 1.6 because SWT raised the bar for desktop Java applications. The competition is good for Java. The tired anti-SWT FUD is not.

  9. Development builds of NetBeans 5.0 do use subpixel antialiasing and look great!


All comments are checked. Comment SPAM will be blocked and deleted.

Note: Only a member of this blog may post a comment.