Java's Swing Threading

前端 未结 3 897
星月不相逢
星月不相逢 2020-12-16 16:36

My understanding is that if I start up another thread to perform some actions, I would need to SwingUtilities.invokeAndWait or SwingUtilities.invokeLater<

3条回答
  •  遥遥无期
    2020-12-16 17:05

    You should consider using SwingWorker since it will not block the UI thread, whereas both SwingUtilities methods will execute on the EDT thread, thus blocking the UI.

提交回复
热议问题