What's the deal with Swing?

Bryan Sant bryan.sant at gmail.com
Tue Mar 28 23:40:04 MST 2006


On 3/28/06, ross at indessed.com <ross at indessed.com> wrote:
> [Chapter 1: Swing]
>I still don't think you can make your Swing app have XP-ish widgets today.

Yes you can.  Java 1.5 hooks into the Windows theme engine (this is
what Qt does too).  Swing's Windows look and feel looks EXACTLY like
Windows XP (any XP theme chosen, not just the default one).  Sun did a
poor job of emulating the GTK/Gnome themes in 1.4 and 1.5, but 1.6
will tie into the GTK theme engine similar to XP -- the expectation is
perfect fidelity with the native theme.

> Swing has been getting faster and faster (probably some to do with
> optimizations, and a lot to do with computers in general just getting faster).

Swing on the current 1.5 JVM is very acceptable, but the new 1.6 JVM
is going to take full advantage of hardware acceleration.  On Windows
the GUI will be painted by calls to Direct3D and OpenGL on Linux.  The
performance improvements are significant.

> running a Swing app on OS X or Linux, you're going to have a pretty good
> user experience. If you're running Swing on Windows, you'll still have a
> pretty good experience, but your app won't integrate well with the rest of
> the system--it will still be, quite obviously, a Java app.

The big focus for Java 1.6 is desktop integration.  The new JVM and
Swing API's will allow for much tighter integeration with the
underling platform.

Read more here:
http://java.sun.com/developer/technicalArticles/J2SE/Desktop/mustang/index.html

> Also, a lot of people just don't like Java on the desktop for Java-specific
> reasons (usually JVM behaviors like eating memory for lunch or the slow
> launch time)

The memory hungry reputation of java is actually a misconception.  The
memory allocation that the OS reports that Java is using is inaccurate
because it counts all memory mapped files as taking up that amount of
space in RAM when in reality it isnt.  This is mostly an issue on
*nix.  Even though this isn't an actual problem, it is going to be
"fixed" in 1.6 as well.

Read more here:
http://weblogs.java.net/blog/xiaobinlu/archive/2005/08/perception_real_1.html

As for slow launch/startup times, I think our last little performance
competion has show how far Java has come in startup time.  The JVM
starts up, loads its classes, verifies their security, compiles them
into native code, and executes in mere milliseconds.  Java startup
time will never be up with C/C++, but it isn't really an issue as of
1.5. 1.6 startup is even faster.  Also, 1.6 has a new splash screen
API that will throw up a splash screen instantly when your Swing app
launches so your users don't wait half a second before a splash comes
up.

-Bryan



More information about the PLUG mailing list