Swing Skins

10/09/14 Several pictures and links on this post are no longer available.

It’s been quite some time since I wrote in the blog. I went on holiday to Portugal and Spain, and when I came back, the weather was great! I was still in summer mood which made it difficult to get some work done.

In the meantime some nice things happened: Aerith code was released and I purshased two new books.

Since I’ve been developing UI in C++ for one year (check TomTom Home), I now decided to give it a try with Java Swing. I’ve done some UI with Swing while I was studying, but I always used standard components. I also used Eclipse Rich Platform to develop the Multi-Agent Planning Framework Editor.


But for me, it’s customization that makes the difference and the enthusiasm to develop UIs.

After reading a bit from Swing Hacks and looking into Aerith’s code I made a small skinnable application that demonstrates the use transparent buttons and text in a customized title bar and frame:

I took me a few hours to finally make the buttons background transparent. The reason is that the code of “Hack 1” in Swing Hacks did not work for me:


setMargin(new Insets(0,0,0,0));






The next code did work:



setContentAreaFilled(false); // This makes the difference of having a transparent background or not.


You can download application jar here. To change the color of the skin click the little tools button!

You can also try this Java Web Start application that I did before. If you run this application using this jar you can drag the title bar, and the frame will not have the default decorations. Unfortunately, and I don’t know why, I could not make that happen when packaging the application to use with Java Web Start, therefore the standard frame will be there.


August Books

Swing Hacks: Tips & Tools for Building Killer GUI’s (amazon.co.uk)
by Joshua Marinacci & Chris Adamson

I only read the 2 first hacks till now, but I’m allreay making some experiences! 😛 I was very curious about this book. More about it later!

Swing Hacks helps Java developers move beyond the basics of Swing, the graphical user interface (GUI) standard since Java 2. If you’re a Java developer looking to build enterprise applications with a first-class look and feel, Swing is definitely one skill you need to master. This latest title from O’Reilly is a reference to the cool stuff in Swing. It’s about the interesting things you learn over the years–creative, original, even weird hacks–the things that make you say, “I didn’t know you could even do that with Swing!” (…)

Swing Second Edition (amazon.co.uk)
by Matthew Robinson & Pavel Vorobiev

Well, if I want to know Swing I need a Swing bible. 🙂

Written for the experienced Java developer, Swing provides an in-depth guide to getting the most out of Sun’s Swing/JFC user interface classes. Mixing real-world code examples and expert advice on advanced features, this book shows how to make use of this powerful library effectively within your own projects. (…)