I was reading an example about how to use the media tracker...
[http://java.sun.com/j2se/1.5.0/docs/api/java/awt/MediaTracker.html]
and i have the following question .. what is the purpose of that line ?
public void run() {
try {
tracker.waitForID(0);
tracker.waitForID(1);
} catch (InterruptedException e) {
return;
}
Thread me = Thread.currentThread();
while (animator == me) {
try {
Thread.sleep(100);
} catch (InterruptedException e) {
break;
}
synchronized (this) { //<----- this line
index++;
if (index >= anim.length) {
index = 0;
}
}
repaint();
}
}
The programe works very well without that line anyway....
Edited by: Pitelk on Jul 3, 2009 10:01 PM