Issue with Java join() method.

Posted by gmunk on Stack Overflow See other posts from Stack Overflow or by gmunk
Published on 2010-05-06T03:20:04Z Indexed on 2010/05/06 3:28 UTC
Read the original article Hit count: 263

Filed under:
|

First of all here are some code snippets:

http://pastebin.com/9ZCwekXs

http://pastebin.com/TtLLXPYP

I'm trying to animate some images. The thing is that I want the main thread to wait for the animation thread to finish and then to continue. I searched around, read a little bit and decided to use the join() method. It perfectly waits for the thread to finish but I doesn't animate correctly. The repaint() method gets called 2 times instead of nine. I think maybe the problem is because I used singletons. Here is the singleton implementation.

http://pastebin.com/bA3qLZJE

© Stack Overflow or respective owner

Related posts about java

Related posts about multithreading