net.lucidviews.util.gui
Class RepaintThread
java.lang.Object
java.lang.Thread
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
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. |
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 |
_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.
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 repaintedperiod
- the time between each render, in milli-seconds
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.