org.gicentre.utils.gui

## Class TextInput

- java.lang.Object
- - org.gicentre.utils.gui.TextInput

-     public class TextInput
      extends java.lang.Object

  Class for creating a text-field type input area. Typed text is displayed on screen with a simple caret. Can be used for single or multiple lines. No decoration of the input area is provided but this can be added externally.
  Version:
    3.4, 5th February, 2016.
  Author:
    Jo Wood, giCentre, City University London.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `TextInput(processing.core.PApplet parent, processing.core.PFont font, float textSize)` Initialises the text input area with the given font.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `draw(float x, float y)` Displays the currently entered input text at the given coordinates.
    `java.lang.String` | `getText()` Reports the text that has been entered in the input field.
    `void` | `keyPressed()` Updates the text input area with whatever is typed in with the keyboard.
    `void` | `setText(java.lang.String text)` Sets the text to be displayed in the text input area.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### TextInput

          public TextInput(processing.core.PApplet parent,
                           processing.core.PFont font,
                           float textSize)

      Initialises the text input area with the given font.
      Parameters:
        `parent` - Sketch in which this text input area is to appear.
        `font` - Font used to display text.
        `textSize` - Size of text to display in pixel units.

  - ### Method Detail

    - #### draw

          public void draw(float x,
                           float y)

      Displays the currently entered input text at the given coordinates. This method should be called whenever the text needs updating.
      Parameters:
        `x` - X-coordinate of the top-left of the input field
        `y` - Y-coordinate of the top-left of the input field.

    - #### keyPressed

          public void keyPressed()

      Updates the text input area with whatever is typed in with the keyboard. It is the responsibility of the parent sketch to call this method to monitor key presses. This is most likely to be done in the parent sketch's own `keyPressed()` method.

    - #### setText

          public void setText(java.lang.String text)

      Sets the text to be displayed in the text input area. This can be useful if you wish to clear the text area after return has been pressed for example.
      Parameters:
        `text` - Text to display in text input area. Can be empty if you wish to 'reset' the field.

    - #### getText

          public java.lang.String getText()

      Reports the text that has been entered in the input field.
      Returns:
        Text entered in the input field.