How do you use the Event Dispatch Thread?

后端 未结 4 1267
夕颜
夕颜 2020-12-09 20:50

I learned about how swing isn\'t thread-safe. Delving deeper, I discovered that every modification to a swing component must be done on the Event Dispatch Thread in order to

4条回答
  •  情歌与酒
    2020-12-09 21:10

    Not all your UI code must be part of a runnable in an invokeLater call. That is simply because a large part of your program will be run on the EDT anyway. You need to dispatch messages to the EDT only when you are on a different thread.

提交回复
热议问题