edu.gatech.cs2335.lemmings.gui
Class LTextField

java.lang.Object
  extended byedu.gatech.cs2335.lemmings.gui.LComponent
      extended byedu.gatech.cs2335.lemmings.gui.LLeafComponent
          extended byedu.gatech.cs2335.lemmings.gui.LColoredComponent
              extended byedu.gatech.cs2335.lemmings.gui.LTextField
All Implemented Interfaces:
IClickable, ITypable

public final class LTextField
extends LColoredComponent
implements ITypable, IClickable

Class LTextField: This guy basically allows one to type in some text.

 Revision History:
     v1.0 (Apr. 14, 2004) - Created the LTextField class
 

Version:
Version 1.0, Apr. 14, 2004
Author:
Vladimir Urazov

Field Summary
static java.awt.Dimension CHARACTER_DIMENSION
          The dimensions of one character.
 
Fields inherited from class edu.gatech.cs2335.lemmings.gui.LColoredComponent
DEFAULT_BACKGROUND_COLOR, DEFAULT_FOREGROUND_COLOR
 
Constructor Summary
LTextField()
          Creates a new LTextField instance.
LTextField(java.lang.String initialText)
          Creates a new LTextLabel instance.
 
Method Summary
 void backSpace()
          Does a backspace.
protected  void copy(LComponent component)
          Deep-copies self into the component passed in.
 void delete()
          Does a delete.
 void end()
          Does an END.
 int getCaretPosition()
          Returns the caret position.
 int getNumColumns()
          Get the value of numColumns.
 java.lang.String getText()
          Returns the text of this label.
 void home()
          Does a HOME.
 void moveCaretLeft()
          Moves the caret one to the left if possible.
 void moveCaretRight()
          Moves the caret one to the right is possible.
protected  boolean paint(java.awt.Graphics g)
          Performs all of the necessary drawing for this control only.
 void processKeyTyped(char key, int modifiers)
          Processes the key type event.
 void registerMouseClick(int button, java.awt.Point coords)
          Registers the click of a mouse button at the specified coordinates.
 void setCaretPosition(int newPosition)
          Sets the new caret position if possible.
 void setNumColumns(int v)
          Set the value of numColumns.
 void setText(java.lang.String t)
          Gives this label new text.
protected  void updateDimensions()
          Updates the bounds of the button.
 
Methods inherited from class edu.gatech.cs2335.lemmings.gui.LColoredComponent
getBackground, getForeground, setBackground, setBackground, setForeground, setForeground
 
Methods inherited from class edu.gatech.cs2335.lemmings.gui.LLeafComponent
makeDirty, move, renderAll
 
Methods inherited from class edu.gatech.cs2335.lemmings.gui.LComponent
bringToTop, cleanUp, getBounds, getParent, initialize, isActive, isComponentDirty, isShown, setBounds, setDirty, setParent, setPosition, setShown, setSize, setSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CHARACTER_DIMENSION

public static final java.awt.Dimension CHARACTER_DIMENSION
The dimensions of one character.

Constructor Detail

LTextField

public LTextField()
Creates a new LTextField instance.


LTextField

public LTextField(java.lang.String initialText)
Creates a new LTextLabel instance.

Parameters:
initialText - a String value
Method Detail

getText

public java.lang.String getText()
Returns the text of this label.

Returns:
a String value

setText

public void setText(java.lang.String t)
Gives this label new text.

Parameters:
t - a String value

getNumColumns

public int getNumColumns()
Get the value of numColumns.

Returns:
value of numColumns.

setNumColumns

public void setNumColumns(int v)
Set the value of numColumns.

Parameters:
v - Value to assign to numColumns.

updateDimensions

protected void updateDimensions()
Updates the bounds of the button.

Overrides:
updateDimensions in class LComponent

setCaretPosition

public final void setCaretPosition(int newPosition)
Sets the new caret position if possible.

Parameters:
newPosition - an int value

getCaretPosition

public final int getCaretPosition()
Returns the caret position.

Returns:
an int value

moveCaretLeft

public final void moveCaretLeft()
Moves the caret one to the left if possible.


moveCaretRight

public final void moveCaretRight()
Moves the caret one to the right is possible.


home

public final void home()
Does a HOME.


end

public final void end()
Does an END.


backSpace

public final void backSpace()
Does a backspace.


delete

public final void delete()
Does a delete.


registerMouseClick

public void registerMouseClick(int button,
                               java.awt.Point coords)
Registers the click of a mouse button at the specified coordinates.

Specified by:
registerMouseClick in interface IClickable
Parameters:
button - an int value
coords - a Point value

processKeyTyped

public void processKeyTyped(char key,
                            int modifiers)
Processes the key type event.

Specified by:
processKeyTyped in interface ITypable
Parameters:
key - The key that was typed.
modifiers - The modifiers that accompanied the key-type. This is a collection of ORed flags, like SHIFT, ALT, etc.

copy

protected void copy(LComponent component)
Deep-copies self into the component passed in.

Specified by:
copy in class LComponent
Parameters:
component - a LComponent value

paint

protected boolean paint(java.awt.Graphics g)
Performs all of the necessary drawing for this control only. The children will be taken care of separately. This method need not concern itself with them.

Specified by:
paint in class LComponent
Parameters:
g - a Graphics value
Returns:
a boolean value