// @topic S-0301-01-15-30 Java JTable and MVC Architecture Demo // @brief class ThreadAnimation (a worker thread) package Week01; public class ThreadAnimation implements Runnable { //------------------------------ // data //------------------------------ private static final long ANIMATION_TIMEOUT_MS = 500; // half second private ControllerDemo controller; private int count; //------------------------------ // constructors //------------------------------ public ThreadAnimation( ControllerDemo controller ) { this.controller = controller; }//ThreadAnimation //------------------------------ // operations //------------------------------ @Override public void run() { for ( count = 0; count < 24; ++count ) { try { Thread.sleep( ANIMATION_TIMEOUT_MS ); } catch ( InterruptedException ex ) { return; } controller.animate(); } }//run public int getCount() { return count; }//getCount }//class ThreadAnimation