net.minecraft.client.gui

## Class GuiTextField

- java.lang.Object
- - net.minecraft.client.gui.Gui
  - - net.minecraft.client.gui.GuiTextField

-     public class GuiTextField
      extends Gui

- - ### Field Summary

    - ### Fields inherited from class net.minecraft.client.gui.Gui

      `icons, optionsBackground, statIcons`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `GuiTextField(FontRenderer par1FontRenderer, int par2, int par3, int par4, int par5)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `deleteFromCursor(int par1)` delete the selected text, otherwsie deletes characters from either side of the cursor.
    `void` | `deleteWords(int par1)` Deletes the specified number of words starting at the cursor position.
    `void` | `drawTextBox()` Draws the textbox
    `int` | `func_73798_a(int par1, int par2, boolean par3)`
    `int` | `getCursorPosition()` returns the current position of the cursor
    `boolean` | `getEnableBackgroundDrawing()` get enable drawing background and outline
    `int` | `getMaxStringLength()` returns the maximum number of character that can be contained in this textbox
    `int` | `getNthWordFromCursor(int par1)` see @getNthNextWordFromPos() params: N, position
    `int` | `getNthWordFromPos(int par1, int par2)` gets the position of the nth word.
    `String` | `getSelectedtext()`
    `int` | `getSelectionEnd()` the side of the selection that is not the cursor, maye be the same as the cursor
    `String` | `getText()` Returns the text beign edited on the textbox.
    `boolean` | `getVisible()`
    `int` | `getWidth()` returns the width of the textbox depending on if the the box is enabled
    `boolean` | `isFocused()` getter for the focused field
    `void` | `mouseClicked(int par1, int par2, int par3)` Args: x, y, buttonClicked
    `void` | `moveCursorBy(int par1)` Moves the text cursor by a specified number of characters and clears the selection
    `void` | `setCanLoseFocus(boolean par1)` if true the textbox can lose focus by clicking elsewhere on the screen
    `void` | `setCursorPosition(int par1)` sets the position of the cursor to the provided index
    `void` | `setCursorPositionEnd()` sets the cursors position to after the text
    `void` | `setCursorPositionZero()` sets the cursors position to the beginning
    `void` | `setDisabledTextColour(int par1)`
    `void` | `setEnableBackgroundDrawing(boolean par1)` enable drawing background and outline
    `void` | `setEnabled(boolean par1)`
    `void` | `setFocused(boolean par1)` setter for the focused field
    `void` | `setMaxStringLength(int par1)`
    `void` | `setSelectionPos(int par1)` Sets the position of the selection anchor (i.e.
    `void` | `setText(String par1Str)` Sets the text of the textbox.
    `void` | `setTextColor(int par1)` Sets the text colour for this textbox (disabled text will not use this colour)
    `void` | `setVisible(boolean par1)` Sets whether or not this textbox is visible
    `boolean` | `textboxKeyTyped(char par1, int par2)` Call this method from you GuiScreen to process the keys into textbox.
    `void` | `updateCursorCounter()` Increments the cursor counter
    `void` | `writeText(String par1Str)` replaces selected text, or inserts text at the position on the cursor

    - ### Methods inherited from class net.minecraft.client.gui.Gui

      `drawCenteredString, drawRect, drawString, drawTexturedModalRect, drawTexturedModelRectFromIcon`

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

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

- - ### Constructor Detail

    - #### GuiTextField

          public GuiTextField(FontRenderer par1FontRenderer,
                      int par2,
                      int par3,
                      int par4,
                      int par5)

  - ### Method Detail

    - #### updateCursorCounter

          public void updateCursorCounter()

      Increments the cursor counter

    - #### setText

          public void setText(String par1Str)

      Sets the text of the textbox.

    - #### getText

          public String getText()

      Returns the text beign edited on the textbox.

    - #### getSelectedtext

          public String getSelectedtext()

      Returns:
        returns the text between the cursor and selectionEnd

    - #### writeText

          public void writeText(String par1Str)

      replaces selected text, or inserts text at the position on the cursor

    - #### deleteWords

          public void deleteWords(int par1)

      Deletes the specified number of words starting at the cursor position. Negative numbers will delete words left of the cursor.

    - #### deleteFromCursor

          public void deleteFromCursor(int par1)

      delete the selected text, otherwsie deletes characters from either side of the cursor. params: delete num

    - #### getNthWordFromCursor

          public int getNthWordFromCursor(int par1)

      see @getNthNextWordFromPos() params: N, position

    - #### getNthWordFromPos

          public int getNthWordFromPos(int par1,
                              int par2)

      gets the position of the nth word. N may be negative, then it looks backwards. params: N, position

    - #### func_73798_a

          public int func_73798_a(int par1,
                         int par2,
                         boolean par3)

    - #### moveCursorBy

          public void moveCursorBy(int par1)

      Moves the text cursor by a specified number of characters and clears the selection

    - #### setCursorPosition

          public void setCursorPosition(int par1)

      sets the position of the cursor to the provided index

    - #### setCursorPositionZero

          public void setCursorPositionZero()

      sets the cursors position to the beginning

    - #### setCursorPositionEnd

          public void setCursorPositionEnd()

      sets the cursors position to after the text

    - #### textboxKeyTyped

          public boolean textboxKeyTyped(char par1,
                                int par2)

      Call this method from you GuiScreen to process the keys into textbox.

    - #### mouseClicked

          public void mouseClicked(int par1,
                          int par2,
                          int par3)

      Args: x, y, buttonClicked

    - #### drawTextBox

          public void drawTextBox()

      Draws the textbox

    - #### setMaxStringLength

          public void setMaxStringLength(int par1)

    - #### getMaxStringLength

          public int getMaxStringLength()

      returns the maximum number of character that can be contained in this textbox

    - #### getCursorPosition

          public int getCursorPosition()

      returns the current position of the cursor

    - #### getEnableBackgroundDrawing

          public boolean getEnableBackgroundDrawing()

      get enable drawing background and outline

    - #### setEnableBackgroundDrawing

          public void setEnableBackgroundDrawing(boolean par1)

      enable drawing background and outline

    - #### setTextColor

          public void setTextColor(int par1)

      Sets the text colour for this textbox (disabled text will not use this colour)

    - #### setDisabledTextColour

          public void setDisabledTextColour(int par1)

    - #### setFocused

          public void setFocused(boolean par1)

      setter for the focused field

    - #### isFocused

          public boolean isFocused()

      getter for the focused field

    - #### setEnabled

          public void setEnabled(boolean par1)

    - #### getSelectionEnd

          public int getSelectionEnd()

      the side of the selection that is not the cursor, maye be the same as the cursor

    - #### getWidth

          public int getWidth()

      returns the width of the textbox depending on if the the box is enabled

    - #### setSelectionPos

          public void setSelectionPos(int par1)

      Sets the position of the selection anchor (i.e. position the selection was started at)

    - #### setCanLoseFocus

          public void setCanLoseFocus(boolean par1)

      if true the textbox can lose focus by clicking elsewhere on the screen

    - #### getVisible

          public boolean getVisible()

      Returns:
        `true` if this textbox is visible

    - #### setVisible

          public void setVisible(boolean par1)

      Sets whether or not this textbox is visible