Safe to use Component.repaint() outside EDT?

前端 未结 3 1702
误落风尘
误落风尘 2020-12-03 06:49

I cannot find any official documentation saying that it is safe to call Component.repaint from another thread than the Event Dispatch Thread, the EDT.

Is this so? A

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-03 07:53

    Here is a quote from an official page stating that:

    The following JComponent methods are safe to call from any thread: repaint(), revalidate(), and invalidate(). The repaint() and revalidate() methods queue requests for the event-dispatching thread to call paint() and validate(), respectively.

    EDIT 1 :


    Since the previous link mentioned has been shifted. I am posting a new link, though it might take a bit more time to actually know the authenticity of this page, since it appears to be from Java though it originated from some University's server, as can be seen from the address bar.

提交回复
热议问题