net.lucidviews.util.gui
Class RepaintThread

java.lang.Object
  extended by java.lang.Thread
      extended by net.lucidviews.util.gui.RepaintThread
All Implemented Interfaces:
Runnable

public class RepaintThread
extends Thread

A Thread that causes a GUI component to refresh by periodically calling the repaint method.

Since:
1.0
Version:
$Revision: 1.3 $
Author:
Stephen Battey

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
protected  Component _component
          The UI component to be refreshed.
protected  boolean _keepRepainting
          A flag used to elegantly stop the thread.
protected  long _repaintPeriod
          The number of milli-seconds between each call to the repaint method.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
RepaintThread(Component component, long period)
          Create a thread that periodically calls repaint on a given component.
 
Method Summary
 void doStop()
          Terminate this thead.
 void run()
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_repaintPeriod

protected long _repaintPeriod
The number of milli-seconds between each call to the repaint method.


_component

protected Component _component
The UI component to be refreshed.


_keepRepainting

protected boolean _keepRepainting
A flag used to elegantly stop the thread.

Constructor Detail

RepaintThread

public RepaintThread(Component component,
                     long period)
Create a thread that periodically calls repaint on a given component.

Parameters:
component - the GUI component to be periodically repainted
period - the time between each render, in milli-seconds
Method Detail

run

public void run()
Specified by:
run in interface Runnable
Overrides:
run in class Thread

doStop

public void doStop()
Terminate this thead.
This happens asynchronously. This method may return without the thread actually having terminated but with the termination pending.