If you remove "JOptionPane.showMessageDialog(null, message);" from your code, it will work fine, but I can't figure out why :P.
Might be down to not specifying a parent, and its therefore not...