What's the deal with Swing?
dave at thesmithfam.org
Wed Mar 29 07:59:30 MST 2006
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. :-(
Indeed. A price my company gladly pays to use it. Trolltech's support is
awesome too (which is rare for commercial software, I've found).
> Mustang's GroupLayout (used by the Netbeans builder) is even better.
> Also Java's BoxLayout works like Qt's horiz and vert layouts.
So you have to use third party layout managers to improve your Swing
> No. As long as someone has a 1.5 or better JVM, the JNLP descriptor
> will tell them that they need a newer JRE to run your WebStart app (if
> you require a newer JRE) and the older JVM they have will know to
> download the newer JVM to run your app (with the user's permission).
But they still have to be savvy enough to download and install the JVM.
Anything more than Next Next Next will confuse Windows users. :)
>> the JVM is huge, even by today's standards.
> 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".
That's an order of magnitude larger than any Qt GUI installer I've
>> * Swing is ugly by default
> 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
I think Ocean looks pretty good, but it still doesn't look native by
default. To most users, that means "weird" at best and "ugly" at worst.
> Choose here: http://www.javootoo.com/
> Who wouldn't want to use napkin look and feel :-) ?
I do think napkin is cool, way cool for mock-ups!
> Qt does look good by default. But just for the record, you know that
> Qt is doing exactly what Swing does. It emulates the native look and
> feel (draws its own widgets). SWT is literally using native widgets,
> so SWT is "right" and both Qt and Swing have the possibility of being
Yup, Qt is line-drawn, but for whatever reason it's always been quite
fast, even on 3-year old computers. Plus, it looks "right." Why doesn't
Swing look "right" by default, and why hasn't it always been fast?
(sorry, those are rhetorical questions).
> I don't follow. At least in Java 1.5 and better JCanvas is
> double-buffered and it has always known how to draw itself. This is a
> common UI composite design pattern. I may be wrong (because I haven't
> worked with QCanvas), but I bet their API and capability is nearly
> identical. If you want to see some cool things done with JCanvas
> launch this with 1.5 or 1.6:
Unless I'm mistaken, you still have to draw all of JCanvas's items with
paint methods. You can't instantiate objects that live on the JCanvas,
draw themselves, animate themselves, know their velocity, etc. You have
to keep track of all that. And yes, JCanvas has always been
double-buffered, but not by default. You had to turn it on (not sure if
that's changed). QCanvas is double-buffered by default.
>> * Swing is slow by default
> You mean the *preception* is that swing is slow because people run
> blocking code on the the even queue thread.
Yes. What I mean here is that it is easier to make quick and responsive
GUIs in Qt because it is fast by default. You don't have to use Worker
objects or some 3rd party library just to make your GUI reasonably
responsive. You just use the normal Qt classes, and your GUI will be
responsive, always. That's what I meant with "by default".
> 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.
I'll grant you that. Is the version of Netbeans you refer to available now?
A lot of the stuff you said will depend on Java 1.6. Would that imply
that Swing is about 2-3 years behind Qt?
Anyway, I think this has been a pretty productive conversation on Swing
vs. others, and I'm glad to see that it hasn't degenerated into an ad
hominem flame war.
More information about the PLUG