Your code doesn't seem to handle the various possible message content types. I'd say the first thing to do would be to do away with the JOptionPane.showMessageDialog calls as they get in the way of...