com.jgoodies.animation.renderer
Class AbstractTextRenderer

java.lang.Object
  extended by com.jgoodies.animation.renderer.AbstractTextRenderer
All Implemented Interfaces:
AnimationRenderer
Direct Known Subclasses:
BasicTextRenderer, GlyphRenderer

public abstract class AbstractTextRenderer
extends java.lang.Object
implements AnimationRenderer

An abstract superclass that helps implementing typographic animation renderers.

Version:
$Revision: 1.1 $
Author:
Karsten Lentzsch

Field Summary
protected  java.awt.Shape[] cachedGlyphShapes
           
protected  java.awt.font.GlyphVector cachedGlyphVector
           
protected  float cachedTextAscent
           
protected  float cachedTextHeight
           
protected  float cachedTextWidth
           
protected  float capitalMAscent
           
 
Method Summary
protected  void ensureValidCache(java.awt.Graphics2D g2)
           
protected  float getAdjustedAscent()
          Computes and answers the text ascent using the current height mode.
protected  float getAdjustedDescent()
          Computes and answers the text descent using the current height mode.
 java.awt.Color getColor()
           
 java.awt.Font getFont()
           
 HeightMode getHeightMode()
           
 java.lang.String getText()
           
protected  void invalidateCache()
          Invalidates the cache.
protected  boolean isCacheValid()
           
protected  void setCacheValid(boolean b)
           
 void setColor(java.awt.Color color)
           
 void setFont(java.awt.Font newFont)
          Sets the renderer's font.
 void setHeightMode(HeightMode heightMode)
           
 void setText(java.lang.String newText)
          Sets the renderer's text.
protected  void validateCache(java.awt.Graphics2D g2)
          Validates the cache, here: creates a GlyphVector and computes and stores its size information.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.jgoodies.animation.AnimationRenderer
render
 

Field Detail

cachedGlyphVector

protected java.awt.font.GlyphVector cachedGlyphVector

cachedGlyphShapes

protected java.awt.Shape[] cachedGlyphShapes

cachedTextWidth

protected float cachedTextWidth

cachedTextAscent

protected float cachedTextAscent

cachedTextHeight

protected float cachedTextHeight

capitalMAscent

protected float capitalMAscent
Method Detail

getColor

public java.awt.Color getColor()

getFont

public java.awt.Font getFont()

getText

public java.lang.String getText()

getHeightMode

public HeightMode getHeightMode()

setColor

public void setColor(java.awt.Color color)

setHeightMode

public void setHeightMode(HeightMode heightMode)

setFont

public void setFont(java.awt.Font newFont)
Sets the renderer's font.

Parameters:
newFont - the font to be set

setText

public void setText(java.lang.String newText)
Sets the renderer's text.

Parameters:
newText - the text to be set

getAdjustedAscent

protected float getAdjustedAscent()
Computes and answers the text ascent using the current height mode.

Returns:
the ascent adjusted using the current height mode
See Also:
getHeightMode()

getAdjustedDescent

protected float getAdjustedDescent()
Computes and answers the text descent using the current height mode.

Returns:
the descent adjusted to the current height mode
See Also:
getHeightMode()

isCacheValid

protected boolean isCacheValid()

setCacheValid

protected void setCacheValid(boolean b)

ensureValidCache

protected void ensureValidCache(java.awt.Graphics2D g2)

validateCache

protected void validateCache(java.awt.Graphics2D g2)
Validates the cache, here: creates a GlyphVector and computes and stores its size information.

Parameters:
g2 - the Graphics object used to get the font render context

invalidateCache

protected void invalidateCache()
Invalidates the cache.



Copyright © 2001-2006 JGoodies Karsten Lentzsch. All Rights Reserved.