LWN.net Logo

Swing and AWT, argh

Swing and AWT, argh

Posted May 22, 2006 22:20 UTC (Mon) by man_ls (subscriber, #15091)
In reply to: Swing and AWT, argh by lauwenmark
Parent article: Harmony project to get a Swing/AWT implementation

The goal of using Swing was to provide an abstraction layer that made possible for an application to display and behave exactly the same on all platforms - a goal the limited design of AWT was unable to fullfill.
Yes, that is exactly what I was talking about: a problem that nobody had. People wanted their programs to look different on different operating systems, not uniformly ugly. That is why all the other toolkits (Qt, GTK, wxWidgets, the old OPENSTEP) look different on different targets. And still some people don't get it.
Given that the current implementations of Swing are able to use underlying accelerated graphical capabilities (D3D/OpenGL) where available, the lack of speed Swing had in the past seems hardly relevant nowadays.
Hardware acceleration does not magically solve all problems. In fact 3d hardware acceleration solves very specific problems; it does nothing for bloat.
Now, maybe you have some benchmarks to back up your facts ?
Not really, since the question is not that hot any more. Right now I can offer you some home benchmarks which you will not accept anyway (and with good reason).
  • Hello world: Swing 21 MB and .5 sec, SWT 10.0 MB and .1 sec.
  • Window with 100 buttons: Swing 24 MB and .55 sec, SWT 10.3 MB and .1 sec.
  • Table with 1000 rows: Swing 26 MB and .6 sec, SWT 13.3 MB and .3 sec.
  • Window with 1000 buttons: Swing 24 MB and .7 sec, SWT 13.6 MB and .35 sec.
This on Windows 2k with Sun's JDK 1.5. None of them is particularly stellar, but Swing is a hog.
[...] nothing prevents you to develop and use your own LnF if you don't like the provided ones.
Let us see... Yes, boredom prevents me. SWT looks good (or as bad as the rest on my OS) without any efforts.
Other bad news related to SWT: only the Windows implementation is decent performance-wise;
Some years ago I tried eclipse on my old iMac DV, and it barely run at all (whereas other Swing programs just refused to even try). On my old Linux machine running Sun's JRE it worked, not very fast but usable.

Well, guess what: I just downloaded eclipse for my Ubuntu system, and it runs quite fine. Even though (or maybe because) it uses gcj. It is not as snappy as on Windows, but to tell you the truth Gnome is not either as snappy as KDE.

the documentation is far from the level of what's available on Swing;
In my limited experience I don't have complains.
SWT programming requires manual ressource-management; portability is inferior, some features not being available on all supported platforms.
The rest of your concerns should be answered by people more knowledegeable than myself, like Chris Grindstaff. There are one other aspect of SWT which is probably of interest in this forum: SWT is free software. Swing is not, at least until this Harmony thing came along.


(Log in to post comments)

Copyright © 2008, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds