What's the deal with Swing?

Michael L Torrie torriem at chem.byu.edu
Wed Mar 29 10:05:08 MST 2006


On Wed, 2006-03-29 at 00:26 -0700, Bryan Sant wrote:
> Qt is awesome.  The best UI toolkit in the world for sure.  Too bad
> it's GPL or $2,500 per developer seat.  :-(

Except for the small problem that being written in C++, the bindings to
other languages (Java, included) is not quite as good as it could be.
Contrast this with GTK+ which has excellent bindings to Java, C++,
Python, C#, etc, with an almost 1:1 paradigm mapping to the various
object models.

> 
> > Qt got it just right by providing an excellent graphical GUI builder that
> > actually works!
> 
> Having had used Qt Designer, I know what you mean.  It is awesome. 
> But the new Netbeans GUI builder is EVEN BETTER in my opinion.  Forget
> about any Swing GUI builder you've used in the past -- I can't say
> enough good things about this new builder.  So, yes Swing's API is
> verbose, but with the Netbeans GUI builder you write very little UI
> code.  Just drag-n-drop like you did in VB/Delphi/Power Builder/Qt
> Designer, double click on a widget and write the snippet of code.

Qt Designer is very good, but I sometimes find it quite frustrating.
Actually it's more a matter of understanding how Qt defines the
different sizing hints (do you want minimum+expanding, preferred, or
what?)  The idea of springs is novel, but I like GTK's layout system
much better.  Rather than use springs, GTK uses the idea of Expand and
Fill.  More logical to me.

> <snip>
> 16MB.  I'm not saying that it's small, but the .NET 1.1 runtime is
> 22MB -- .NET 2.0 will be even bigger.  It would take your averge user
> less time to download the JRE than it would for them to do their
> monthly Windows update...  Or daily virus scan...  You choose. 
> Downloading Firefox and Thunderbird takes 10MB.  So I disagree that it
> is big by "today's standards".

While this may be, the fact that under service pack 2 and automatic
updates most people have the .NET runtime whether they want it or not
makes this comparison kind of moot.  

> <snip>
> Java's new default ugly theme is less ugly that the old default ugly
> theme :-).  With Java 5 and better the default theme is "Ocean".  See
> here:

It is indeed better but I still find it looks bad.  It's probably not
because it actually is bad but because it still bears enough resemblance
to the original metal look and feel (and Swing crappiness from the era)
to give many folks including myself a bad feeling in the pit of my
stomach.  Sun should ditch this default look and feel all-together and
always go with native UI integration.  I tried the Java 1.6 betas and
was disappointed that I had to enable the GTK integration, rather than
have it on by default.  For 99% of the deployment platforms out there,
swing has no need or reason to default to anything other than native.

> You mean the *preception* is that swing is slow because people run
> blocking code on the the even queue thread.

perception is everything. GTK+ had a similar image problem back in the
1.2 days.  The entire linux desktop still has to escape this perception.
I don't think Dave is talking about blocking code.  He's talking more
about how Swing (even still) just feels perceptibly slower to react to
the user.  Drawing menus, etc.  Glad this will be addressed in 1.6 and
above.

Michael


> Java 1.6 has SwingWorker that solves this problem, but an even better
> solution is spin (http://spin.sourceforge.net/).
> 
> Qt did do it right out of the box though.  I'm not saying that Swing
> is on par with Qt, but the two are pretty close in terms of concept
> and ease of developerment (with Netbeans GUI builder).  My turn off
> with Qt (it does have Java bindings) is that I have to pay $$ if I
> want to ship something that isn't GPL.  Java is free (as in movie
> tickets) regardless.
> 
> -Bryan
> 
> /*
> PLUG: http://plug.org, #utah on irc.freenode.net
> Unsubscribe: http://plug.org/mailman/options/plug
> Don't fear the penguin.
> */
> 




More information about the PLUG mailing list