org.deken.game.component
Class GScrollingLabel

java.lang.Object
  extended by org.deken.game.sprites.Sprite
      extended by org.deken.game.component.GComponent
          extended by org.deken.game.component.GScrollingLabel
All Implemented Interfaces:
InputMouseListener, Updateable

public class GScrollingLabel
extends GComponent

Title: GScrollingLabel

Description: TODO

Copyright: Copyright (c) Mar 24, 2013

Version:
1.0
Author:
Gary Deken

Nested Class Summary
 
Nested classes/interfaces inherited from class org.deken.game.component.GComponent
GComponent.Alignment, GComponent.MouseActions
 
Field Summary
protected  int startIndex
           
protected  double startSize
           
protected  double xTextOffset
           
 
Fields inherited from class org.deken.game.component.GComponent
horizontalAlignment, id, invalid, keyPolling, mouseActions, parent, requestKeyPolling, screenHeight, screenWidth, verticalAlignment, xOffSet, yOffSet
 
Fields inherited from class org.deken.game.sprites.Sprite
boundingBox, collisionMap, location, size
 
Constructor Summary
GScrollingLabel(java.lang.String text, int width, double speed)
           
GScrollingLabel(java.lang.String text, int width, double speed, java.awt.Font font, java.awt.Color fontColor)
           
 
Method Summary
 GScrollingLabel copy()
           
 void draw(java.awt.Graphics2D graphics, int xOffset, int yOffset)
          Draws the sprite with the current offset.
 java.awt.Color getBackgroundColor()
           
 java.awt.Font getFont()
           
 java.awt.Color getFontColor()
           
 java.lang.String getText()
           
 boolean isInvalid()
           
 void notifyListener(InputMouseAction inputMouseAction)
          notifyListener
 void setBackgroundColor(java.awt.Color backgroundColor)
           
 void setFont(java.awt.Font font)
           
 void setFontColor(java.awt.Color fontColor)
           
 void setInvalid(boolean invalid)
           
 void setMonitored(boolean active)
           
 void setText(java.lang.String text)
           
 void setWidth(int width)
           
protected  void spriteCollison(Sprite collideSprite)
          Handle the collision with another sprite.
 java.lang.String toString()
           
 void update(long elapseTime)
          update
 void validate(java.awt.Graphics2D graphics)
          Uses the current graphics object to get FontMetrics and the size of the text.
 
Methods inherited from class org.deken.game.component.GComponent
addMouseAction, copyBase, getHorizontalAlignment, getMouseActions, getParent, getVerticalAlignment, getXLocation, getYLocation, isEnabled, positionHorizontalAlignment, positionVerticalAlignment, requestKeyPolling, setEnabled, setHorizontalAlignment, setInvalid, setKeyPolling, setParent, setVerticalAlignment
 
Methods inherited from class org.deken.game.sprites.Sprite
getBounds, getDepth, getHeight, getLocation, getName, getSize, getWidth, removeFromMap, setBoundingBox, setBoundingBox, setCollisionMap, setLocation, setName, setSize, updateLocation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

startIndex

protected int startIndex

startSize

protected double startSize

xTextOffset

protected double xTextOffset
Constructor Detail

GScrollingLabel

public GScrollingLabel(java.lang.String text,
                       int width,
                       double speed)
Parameters:
text -
width -
speed -

GScrollingLabel

public GScrollingLabel(java.lang.String text,
                       int width,
                       double speed,
                       java.awt.Font font,
                       java.awt.Color fontColor)
Parameters:
text -
width -
speed -
font -
fontColor -
Method Detail

copy

public GScrollingLabel copy()
Specified by:
copy in class GComponent
Returns:
GComponent

draw

public void draw(java.awt.Graphics2D graphics,
                 int xOffset,
                 int yOffset)
Description copied from class: GComponent
Draws the sprite with the current offset.

Specified by:
draw in class GComponent
Parameters:
graphics -
xOffset -
yOffset -

getFont

public java.awt.Font getFont()

getFontColor

public java.awt.Color getFontColor()

getBackgroundColor

public java.awt.Color getBackgroundColor()

getText

public java.lang.String getText()

isInvalid

public boolean isInvalid()

notifyListener

public void notifyListener(InputMouseAction inputMouseAction)
Description copied from interface: InputMouseListener
notifyListener

This method is called when any Mouse Motion event occurs.

Parameters:
inputMouseAction - InputMouseAction

setBackgroundColor

public void setBackgroundColor(java.awt.Color backgroundColor)

setFont

public void setFont(java.awt.Font font)

setFontColor

public void setFontColor(java.awt.Color fontColor)

setMonitored

public void setMonitored(boolean active)
Specified by:
setMonitored in class GComponent

setText

public void setText(java.lang.String text)

setInvalid

public void setInvalid(boolean invalid)

setWidth

public void setWidth(int width)

toString

public java.lang.String toString()
Overrides:
toString in class Sprite

update

public void update(long elapseTime)
Description copied from class: GComponent
update

This method takes the elapse time, and calculates the new current frame of the animation.

Specified by:
update in interface Updateable
Specified by:
update in class GComponent
Parameters:
elapseTime -

validate

public void validate(java.awt.Graphics2D graphics)
Uses the current graphics object to get FontMetrics and the size of the text.

Specified by:
validate in class GComponent
Parameters:
graphics -

spriteCollison

protected void spriteCollison(Sprite collideSprite)
Description copied from class: Sprite
Handle the collision with another sprite.

Specified by:
spriteCollison in class Sprite