org.problets.lib.io.output.overlay
Class OverlayText

java.lang.Object
  extended by org.problets.lib.io.output.overlay.Overlay
      extended by org.problets.lib.io.output.overlay.OverlayText

public class OverlayText
extends Overlay

Class which either animates a string of text or draws a atring of text without animating it.

Author:
Tihomir Piskuliyski

Constructor Summary
OverlayText(java.lang.String inText, java.awt.Font inFont, java.awt.Color inColor)
          The constructor takes the string named text, the font of the string and its color.
 
Method Summary
 void animate(java.awt.Graphics g, int x, int y)
          Animates a string of text.If the text is animated once and the applet has to be redrawn, the function only draws the text without animating it.
 void draw(java.awt.Graphics g, int x, int y)
          Draws a string of text.
 
Methods inherited from class org.problets.lib.io.output.overlay.Overlay
getHeight, getWidth
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OverlayText

public OverlayText(java.lang.String inText,
                   java.awt.Font inFont,
                   java.awt.Color inColor)
The constructor takes the string named text, the font of the string and its color.

Parameters:
inText - The String to be drawn or animated
inFont - The font the string uses
inColor - The color of the text
Method Detail

draw

public void draw(java.awt.Graphics g,
                 int x,
                 int y)
Draws a string of text.

Overrides:
draw in class Overlay
Parameters:
g - The graphical context of the applet
x - The x coordinate of the lower left corner the bounding box of the text
y - The y coordinate of the lower left corner the bounding box of the text

animate

public void animate(java.awt.Graphics g,
                    int x,
                    int y)
Animates a string of text.If the text is animated once and the applet has to be redrawn, the function only draws the text without animating it. The function creates the font metrics of the string with its specific font and then uses it to get the length of each letter so that each letter is drawn after MillisecondsIterator milli senconds. The animation starts from left to right

Overrides:
animate in class Overlay
Parameters:
g - The graphical context of the applet
x - The x coordinate of the lower left corner the bounding box of the text
y - The y coordinate of the lower left corner the bounding box of the text