public void run()
{
while (timer != null)
{
try
{
timer.sleep(1000);
}catch (InterruptedException e)
{
break;
}
repaint();
}
timer=null;
}