org.deken.game.component
Class GTextEntry
java.lang.Object
org.deken.game.sprites.Sprite
org.deken.game.component.GComponent
org.deken.game.component.GTextContainer
org.deken.game.component.GTextEntry
- All Implemented Interfaces:
- InputMouseListener, Updateable
public class GTextEntry
- extends GTextContainer
Title: GTextEntry
Description: The GTextEntry is a class interacting with user keyboard entry.
It polls the keyboard typing and display the keys typed. It can be set to
have a flashing cursor.
It does not have an Animation element.
Copyright: Copyright (c) Nov 30, 2013
- Version:
- 1.0
- Author:
- Gary Deken
Fields inherited from class org.deken.game.component.GComponent |
horizontalAlignment, id, invalid, keyPolling, mouseActions, parent, requestKeyPolling, screenHeight, screenWidth, verticalAlignment, xOffSet, yOffSet |
Methods inherited from class org.deken.game.component.GComponent |
addMouseAction, copyBase, getHorizontalAlignment, getMouseActions, getParent, getVerticalAlignment, getXLocation, getYLocation, isEnabled, positionHorizontalAlignment, positionVerticalAlignment, requestKeyPolling, setEnabled, setHorizontalAlignment, 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, toString, updateLocation |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
GTextEntry
public GTextEntry(java.awt.Font font,
java.awt.Color fontColor,
int width)
- Parameters:
font
- fontColor
- width
- in pixels
GTextEntry
public GTextEntry(GText gText,
int width)
- Parameters:
gText
- width
- in pixels
addAnimation
public void addAnimation(int id,
Animation animation)
- Specified by:
addAnimation
in class GTextContainer
addFontColor
public void addFontColor(int id,
java.awt.Color color)
- Set the color of the GTextEntry's font color.
- Specified by:
addFontColor
in class GTextContainer
- Parameters:
id
- Not used.color
-
addGText
public void addGText(GText gText)
- Specified by:
addGText
in class GTextContainer
copy
public GComponent 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
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 color)
setFlashingCursor
public void setFlashingCursor(boolean flashingCursor)
setMonitored
public void setMonitored(boolean active)
- Specified by:
setMonitored
in class GComponent
setPadding
public void setPadding(int padding)
setWidth
public void setWidth(int width)
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
- long
validate
public void validate(java.awt.Graphics2D graphics)
- Specified by:
validate
in class GComponent
removeLastCharacter
public void removeLastCharacter()
spriteCollison
protected void spriteCollison(Sprite collideSprite)
- Description copied from class:
Sprite
- Handle the collision with another sprite.
- Specified by:
spriteCollison
in class Sprite