• Share this article:

Understanding Layouts in SWT

Friday, May 11, 2012 - 15:48 by Wayne Beaton

An unrelated problem drew my attention to the Understanding Layouts in SWT article. It’s always bugged me that the many screenshots in this article are represented in JPEG format. JPEG is a lossy format that, in my humble opinion, is inappropriate for screenshots as the images end up with odd dithering that just plain bugs my eyes. So I decided to rebuild the screenshots in PNG format.

When I updated this article in 2008, rather than build and shot each image manually, I wrote a little Java program that builds and shoots all of the images automatically in one fell swoop. At the time, I couldn’t figure out where to store the code; it didn’t belong to any Eclipse project, and the way that Eclipse Corner is set up in CVS makes it an inappropriate place for Java code. At the time, I stuffed it into a private CVS server and forgot about it.

I pulled that code out today, tweaked it a bit, and regenerated the images. I think they look a lot better in PNG format.

I’ve put the code into a repository on GitHub if you’re interested. I’m not sure if it’s a great example of how to bend SWT to your will, but there is a little trickery in there that gets the job done.

Oh… and some food for the trolls: SWT is way better than Swing. FWIW, I haven’t looked at Swing in years; what do I know?