dirty hack wrap dialog.setVisible(true); into invokeLater()
use SwingWorker or Runnable#Thread instead or plain Thread
is there issue that you ignored answers and especially comments from your previous question
Swing Gui doesn't care about output from Thread, because there isn't implemented notifiers for Event Dispatch Thread, you have to invoke that by invokeLater, or to use SwingWorker,
SwingWorkers methods done, publish and progress can notify EDT correctly