Wow! Java (Swing) doesn't have to look crappy!

Saturday October 18, 2008
I have a long love-hate (well, mostly hate-hate) relationship with Java.  I used to be a Swing hacker, in my callow youth, and the whole experience left me feeling pretty bad about Java GUI programming.

Over the years, I've watched as Java has gotten better and better native look and feel on Mac and Windows, but every time I've started a Java application on Linux, it's time to party like it's 1995; the default "Metal" look is reminiscent of a souped-up Motif, and clashes terribly with my desktop.

Totally by accident, I discovered this gem on stackoverflow...

This page explains how the work with Look&Feels:

You can do it commandline:

java MyApp
... and my jaw dropped.  Really?  It's that easy?  I tried it with my favorite Java GUI application, Tiled - and here it is, not looking like crap:

As with every native look and feel, it's not quite right.  The behavior of 'tab' is off in a few places, there are tons of things that should be keyboard-focusable but aren't... but it's a huge improvement.

I still have no idea why this isn't just the default behavior on Linux — although I'm sure I have a few fun inexplicable segfaults to look forward to — but I'm certainly going to enjoy using Java applications quite a bit more now.