Monday, December 27, 2010

Java GUI Toolkits Revisited

At the very beginning of the design of Fractus, Jarrett (the other committer) and I decided to use java-gnome as our GUI framework.  We both like the look of GTK2, and as can be seen on Pidgin, it still looks Windowsy on Windows (though GTK1 did not).  This decision is also largely the result of my failure to research when support for this toolkit ended.  After version 2, a company called Operational Dynamics took over its development.  Because they only have a need for Linux code, they ended support for Windows.  I probably should have looked into this more.  After Jarrett had completed a lot of GUI work, we had to start this part over.

The next decision was made with more research.  We knew that we didn't want to use Swing because Swing applications that we had seen before are ugly.  At the time, I didn't know that you can change the LAF from Metal to something somewhat native.

So, we went with SWT -- the other large and well-supported framework.  SWT itself is a pretty hefty dependency -- not to mention deployment means making separate packages for each of the platform-specific SWT jars.  Later I discovered that SWT is not even close to being MVC.  In fact, you typically can't even subclass things.  I found a bunch of things awkward to do before I discovered JFace (a very large but helpful dependency indeed).  Unfortunately, I didn't discover this until I started playing with...

Swing!  I found Matisse, the Netbeans GUI builder, amazing.  It's just too easy and too flexible.  It's probably my second favorite GUI builder next to Qt's (see below).  I got about 50% done with the GUI design with Swing before I realized that, while I think I got rid of a lot of platform-specific oddities (i.e. the menus looked awful -- sometimes unusably so), I could never make an interface that people would be impressed with.  Though I must say, it was very easy and elegant to make something that is relatively usable while keeping the code very well separated and organized by MVC.  It made it even sweeter that Swing is included with Java SE so there are no external dependencies, but I wasn't satisfied with the very "Swing" look that it has, even when using the platform's pseudo-native rendering.  It gave me a bad taste, like AWT, but far less bad.


Currently, I am torn between
  • Going back to SWT (with JFace this time): the dependency isn't that big, considering disk space and bandwidth are cheap.  This may produce the most functional and pretty interface.  I have used the visual editor and I don't like it nearly as much as the one in NetBeans.
  • Going with Qt Jambi: While Nokia's support for this Java binding has recently ended, development on Qt is extremely active.  It has one of the best GUI designers imaginable that will put out ".ui" files which generate code in almost any modern language (and even Ada!)  Its development has been taken over by an open source community.  Qt4 looks aesthetically amazing.  Skype for Linux uses it -- and I will admit that one thing Skype is very good at is looking pretty!  VLC uses it.  Google Earth uses it.  The list of sexy applications continues and can be found at qt.nokia.com
I hope my quest to find a decent Java GUI toolkit will save you some time.

No comments:

Post a Comment