/** A thread class which calls repaint() to display the image in different positions */ public class work extends Thread { ImageAndSound ias; work(ImageAndSound ias) { this.ias = ias; System.out.println("thread created"); } /** Called by the start method to execute the run method in a separate thread of execution */ public void run (){ System.out.println("inside of run"); while (!ias.is_interrupted()) { if ( this == null ) break; else { try { this.sleep(300); } catch (InterruptedException ie) { System.out.println("InterruptedException:" + ie.getMessage()); }; ias.repaint(); } } } }