i have an animation program using threads and applet.
when i call stop option from applet menu in appletviewer program works normally but when i press restart there is some abnormality in its working. Thread does not come out of the while loop on calling restart at line no.34
class saver
{
.
.
public void run()
{
System.out.println("run "+Thread.currentThread().getName());
func();
System.out.println("out of synchronized block");
}
synchronized public void func()
{
int i;
while(running)
{
for(i=0;i<4;i++)
{
gap[i]+=10;
if(gap[i]==360)
gap[i]=0;
System.out.println(Thread.currentThread().getName());
calc(gap[i],400,i%2==0?(byte)1:(byte)-1);
yb[i]=(int)(y)+yc;
xb[i]=(int)(x)+xc;
}
repaint();
try
{
Thread.sleep(1000);
}
catch(Exception e)
{}
}
System.out.println("out of while in synchronized block");//not being printed
}