Java's Swing Threading

前端 未结 3 896
星月不相逢
星月不相逢 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 16:44

    In my opinion you should almost never use invokeAndWait(). If something is going to take awhile that will lock your UI.

    Use a SwingWorker for this kind of thing. Take a look at Improve Application Performance With SwingWorker in Java SE 6.

提交回复
热议问题