net.groboclown.gui.timeBoundPaint.v1
Class ThreadPainter

java.lang.Object
  |
  +--net.groboclown.gui.timeBoundPaint.v1.ThreadPainter
All Implemented Interfaces:
PaintFinishedListener

public abstract class ThreadPainter
extends Object
implements PaintFinishedListener

Implements a thread which paints an image for a Time Bound Painter, or other Z-Order painting routine. The only method which needs to be implemented is the paint method, which performs the actual painting.

The priority of the thread is 5.


Field Summary
protected  Image img
           
protected  Graphics imgG
           
private  Runnable innerloop
           
private  LoopThread lt
           
private  int paintsFinished
           
private  PaintImageEvent pie
           
private  SynchQueue q
           
private  Object synchOn
           
private  int zorder
           
 
Constructor Summary
ThreadPainter(Image img, SynchQueue q, int zorder)
           
 
Method Summary
protected abstract  void paint(Graphics g, PaintImageEvent pie)
           
 void paintFinished(PaintFinishedEvent pfe)
          Called when all the painting is done.
 void pausePainter()
           
 void resumePainter()
           
 void startPainter()
          Start the painting thread
 void stopPainter()
           
protected  void synch()
          Called to wait for the painter to be finished, so we can go on to another frame.
protected  void unsynch()
          Called to unpause the alg.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

img

protected Image img

imgG

protected Graphics imgG

q

private SynchQueue q

zorder

private int zorder

lt

private LoopThread lt

paintsFinished

private int paintsFinished

synchOn

private Object synchOn

pie

private PaintImageEvent pie

innerloop

private Runnable innerloop
Constructor Detail

ThreadPainter

public ThreadPainter(Image img,
                     SynchQueue q,
                     int zorder)
Method Detail

startPainter

public void startPainter()
Start the painting thread

pausePainter

public void pausePainter()

resumePainter

public void resumePainter()

stopPainter

public void stopPainter()

synch

protected void synch()
Called to wait for the painter to be finished, so we can go on to another frame.

unsynch

protected void unsynch()
Called to unpause the alg.

paintFinished

public void paintFinished(PaintFinishedEvent pfe)
Called when all the painting is done. We announce to the painting thread to start up again.
Specified by:
paintFinished in interface PaintFinishedListener

paint

protected abstract void paint(Graphics g,
                              PaintImageEvent pie)


Written under the LGPL