I think the issue here is that you're not supposed to invoke showMessageDialog
directly. Swing expects that all GUI operations go through the main Swing thread, and as reported in this answer I suspect that the issue here is a race condition between your thread (which shouldn't do touching the GUI directly) and the Swing thread (which is supposed to handle this).
You may want to consider firing off showMessageDialog
from a SwingWorker
or by using invokeLater
.
Hope this helps!