How to use a delay in a swing application

Posted by M.R. on Stack Overflow See other posts from Stack Overflow or by M.R.
Published on 2010-05-05T17:52:21Z Indexed on 2010/05/05 17:58 UTC
Read the original article Hit count: 202

Filed under:
|
|

I am building a swing application. At some point, I have to start an "animation":

...
jpanel1.setBackground(Color.Black);

Delay(milli)   

jpanel1.setBackground(Color.White);
...

and so on.

The gui itself and all the logic behind it work.It is just this time depended color-changing that does not. I have read, that swing is not thread safe, but all the examples I found showed me how to start another thread (for example in the background) but never how to stop the current swing-gui thread.

© Stack Overflow or respective owner

Related posts about java

Related posts about swing