Some cleanup

Hi, at first the code didn't compile for me (OpenJDK7 on Ubuntu). As far as I've googled, it's due to some Swing changes between JDK6 and 7.

Secondly I've run some static analysis tools and used their output to clean up a few small parts of the code. I hope you'll agree with the changes. I'll maybe manually dive into the code later on.