Java 6 and Swing on Linux

Michael L Torrie torriem at chem.byu.edu
Tue Nov 21 12:02:55 MST 2006


On Tue, 2006-11-21 at 08:48 -0700, Dave Smith wrote:
> Having programmed in both Swing and SWT, I prefer the SWT API. Bare in 
> mind, though, that the last version of Swing I used was Java 1.4, so 
> this may not be fair, but the SWT creators got a lot of stuff just 
> right, especially layout managers. I also find SWT less verbose since 
> you add widgets to their parents directly in your constructor call, 
> rather than creating the object, and calling an add() method. On an 
> unimportant note, I prefer the term "Widget" over "Component" personally. :)

I dunno.  I think that having to specify a widget's parent during it's
construction seems a bit backwards, especially after using GTK, Qt, or
any number of other toolkits.  (Although from a biological point of view
it is very logical!)

> 
> All that being said, in my experience, neither Swing nor SWT can hold a 
> candle to Qt. Has anyone checked out Jambi?

Jambi should be everything that Qt normally is, in all its goodness as
well as warts.  As I've mentioned to Dave before, my biggest complaint
about Qt is that the signals and slots mechanism is based on strings,
not actual statically-checked functions (delegates really).  Qt manages
to avoid the inner-class Java dilemma in Jambi by doing the following
things, it appears:

- All classes where methods will receive signals are derived from a Qt
base object, allowing the string-based introspection mechanism to
function (Maybe they use Java introspection, though, but I it doesn't
appear that way).  Under the hood I'm sure there are inner classes
involved..
- Using string signatures when asking a signal to connect to a slot

This makes code neater and cleaner but has the disadvantage of not
statically checking callback signatures at compile time.  This bit me
once when I had a method name clash in my C++ class (can't remember how
I did this though).

I think that the may Java-Gnome does things (with inner classes just
like Swing), while not as concise or clean, is likely safer and less
prone to runtime error trying to match signals and slots.  

> 
> --Dave
> 
> /*
> 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