feud.testgame.gui
Class TextField

java.lang.Object
  extended byfeud.testgame.gui.GUIComponent
      extended byfeud.testgame.gui.TextField

public class TextField
extends GUIComponent

A text field component. After clicking into a text field, you'll get a cursor and can type some stuff into it.


Field Summary
 
Fields inherited from class feud.testgame.gui.GUIComponent
visible
 
Constructor Summary
TextField(int xpos, int ypos, int xdim, int ydim)
          Creates a new text field.
 
Method Summary
 void draw(com.threed.jpct.FrameBuffer buffer)
          Draws this component and all of its childs.
 boolean evaluateInput(MouseMapper mouse, com.threed.jpct.util.KeyMapper mapper)
          Processes key and mouse events in the context of this component.
 java.lang.String getText()
          The current text of the text field.
 void setText(java.lang.String txt)
          Sets the text for the text field.
 
Methods inherited from class feud.testgame.gui.GUIComponent
add, getParent, getParentX, getParentY, getX, getY, isVisible, setVisible, setX, setY
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextField

public TextField(int xpos,
                 int ypos,
                 int xdim,
                 int ydim)
Creates a new text field.

Parameters:
xpos - the x-position of the upper left corner.
ypos - the y-position of the upper left corner.
xdim - the dimension in x direction.
ydim - the dimension in y direction.
Method Detail

getText

public java.lang.String getText()
The current text of the text field.

Returns:
String the text

setText

public void setText(java.lang.String txt)
Sets the text for the text field. Any new text typed by the user will be appended to this text.

Parameters:
txt - the new text

evaluateInput

public boolean evaluateInput(MouseMapper mouse,
                             com.threed.jpct.util.KeyMapper mapper)
Description copied from class: GUIComponent
Processes key and mouse events in the context of this component. It then continues processing on the child components until the event got comsumed by one or the last child has been processed.

Overrides:
evaluateInput in class GUIComponent
Parameters:
mouse - the MouseMapper used to process mouse events
mapper - the KeyMapper used to process key events
Returns:
boolean true, if an event occured in the context of this component or one of its child components.

draw

public void draw(com.threed.jpct.FrameBuffer buffer)
Description copied from class: GUIComponent
Draws this component and all of its childs. Drawing in this "toolkit" is limited to label and text rendering. Rendering the actual component isn't done by this toolkit, but can be added easily.

Overrides:
draw in class GUIComponent
Parameters:
buffer - the FrameBuffer on which to draw to