SwingUtilities.invokeLater

前端 未结 5 1985
遥遥无期
遥遥无期 2020-11-22 09:09

My question is related to SwingUtilities.invokeLater. When should I use it? Do I have to use each time I need to update the GUI components? What does it exactly

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-22 09:58

    Most user-initiated events (clicks, keyboard) will already be on the EDT so you won't have to use SwingUtilities for that. That covers a lot of cases, except for your main() thread and worker threads that update the EDT.

提交回复
热议问题