Java: Using multiple Threads to paint simultaniously on a JPanel
Posted
by user347217
on Stack Overflow
See other posts from Stack Overflow
or by user347217
Published on 2010-05-21T15:28:35Z
Indexed on
2010/05/21
15:30 UTC
Read the original article
Hit count: 120
I have a JPanel on which I wish to have several threads painting "animations" on. An "animation" consists of a JLabel with an ImageIcon on it, which is being moved from one area of the screen to another area.
Now, problem is - I want several such animations to be portrayed on screen by those threads mentioned. Problem is - the JPanel's "paint()" method can only be trigged by one thread at a time - causing the animations to execute serially, instead of in a parallel way.
Any idea how to have several such animations on screen at the same time?
© Stack Overflow or respective owner