org.tbee.swing
Class WatermarkPainter

java.lang.Object
  extended by org.tbee.swing.WatermarkPainter
All Implemented Interfaces:
HierarchyListener, EventListener
Direct Known Subclasses:
WatermarkPainterStamp

public abstract class WatermarkPainter
extends Object
implements HierarchyListener

This class is the abstract base class for objects that know how to paint a WatermarkViewport. Minimally, subclasses must override the paint method.

Note: WatermarkPainters are not designed to be shared between viewports.

Version:
$Revision: 1.2 $

Constructor Summary
WatermarkPainter()
           
 
Method Summary
protected  JViewportWatermark getComponent()
          Return the viewport associated with this painter.
 void hierarchyChanged(HierarchyEvent he)
          Listens for hierarchy events on the current viewport to start or stop this painter when the component's showing state changes.
protected abstract  void paint(Graphics g)
          Paint onto the graphics object indicated by the parameter.
protected  void start()
          Starts any animation that this painter might perform.
protected  void stop()
          Stops any animation that this painter might be performing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WatermarkPainter

public WatermarkPainter()
Method Detail

getComponent

protected final JViewportWatermark getComponent()
Return the viewport associated with this painter.

Returns:
the viewport associated with this painter

start

protected void start()
Starts any animation that this painter might perform. This is called when this painter is registered with a new viewport, if the viewport's showing status is true. It will then be called every time that component's status changes to true.


stop

protected void stop()
Stops any animation that this painter might be performing. This is called when this painter is un-registered, or when the showing status of the current viewport changes to false.


paint

protected abstract void paint(Graphics g)
Paint onto the graphics object indicated by the parameter. This method can query the component returned by getComponent for size information. The component returned is guaranteed to be non-null as setComponent will always be called with a non-null component before any painting is done.

Parameters:
g - the graphics object on which to paint

hierarchyChanged

public void hierarchyChanged(HierarchyEvent he)
Listens for hierarchy events on the current viewport to start or stop this painter when the component's showing state changes.

Specified by:
hierarchyChanged in interface HierarchyListener


Copyright © 2012 KnowledgePlaza. All Rights Reserved.