Day 5: Battles with Swing Layouts

Are you a Java programmer? Have you used Swing? Then you’ll probably feel my pain. I almost always use a GUI builder but for my preferences dialog I needed to do it manually. Working with Swing Layout Managers often feels like a particularly nasty type of voodoo.

It’s because I wanted to use the little ‘+’ and ‘-‘ buttons normally used in OS X preference panels to add and remove things. Apple calls them “segmented gradient buttons”. Unfortunately it is tricky to get them just right. I eventually found the answer here: