Thread sleep inside of actionPerformed method

后端 未结 2 1624
囚心锁ツ
囚心锁ツ 2020-12-21 09:01

First of all I want to say I\'m aware this aproach is wrong so I\'m asking this question because of pure curiousity. Lets say I have a swing application like this:



        
2条回答
  •  粉色の甜心
    2020-12-21 09:19

    1. works in this case, because you programatically freeze ouf Swing GUI, but there is/aren't another update(s), ot another JComponent(s)

    2. doens't works in the case that there are a few another updated to the Swing GUI, Thread.sleep(int) freeze Event Dispatch Thread,

    3. by default all updates to the JComponents XxxModels never will be visible on the JComponents view

    4. example until sleep ended you'll lost all updated to the GUI

提交回复
热议问题