public class GuiTextField extends Gui
Modifier and Type | Field and Description |
---|---|
int |
height |
int |
width
The width of this text field.
|
int |
xPosition |
int |
yPosition |
ICONS, OPTIONS_BACKGROUND, STAT_ICONS, zLevel
Constructor and Description |
---|
GuiTextField(int componentId,
FontRenderer fontrendererObj,
int x,
int y,
int par5Width,
int par6Height) |
Modifier and Type | Method and Description |
---|---|
void |
deleteFromCursor(int num)
Deletes the given number of characters from the current cursor's position, unless there is currently a selection,
in which case the selection is deleted instead.
|
void |
deleteWords(int num)
Deletes the given number of words from the current cursor's position, unless there is currently a selection, in
which case the selection is deleted instead.
|
void |
drawTextBox()
Draws the textbox
|
int |
getCursorPosition()
returns the current position of the cursor
|
boolean |
getEnableBackgroundDrawing()
Gets whether the background and outline of this text box should be drawn (true if so).
|
int |
getId() |
int |
getMaxStringLength()
returns the maximum number of character that can be contained in this textbox
|
int |
getNthWordFromCursor(int numWords)
Gets the starting index of the word at the specified number of words away from the cursor position.
|
int |
getNthWordFromPos(int n,
int pos)
Gets the starting index of the word at a distance of the specified number of words away from the given position.
|
int |
getNthWordFromPosWS(int n,
int pos,
boolean skipWs)
Like getNthWordFromPos (which wraps this), but adds option for skipping consecutive spaces
|
java.lang.String |
getSelectedText()
returns the text between the cursor and selectionEnd
|
int |
getSelectionEnd()
the side of the selection that is not the cursor, may be the same as the cursor
|
java.lang.String |
getText()
Returns the contents of the textbox
|
boolean |
getVisible()
returns true if this textbox is visible
|
int |
getWidth()
returns the width of the textbox depending on if background drawing is enabled
|
boolean |
isFocused()
Getter for the focused field
|
void |
mouseClicked(int mouseX,
int mouseY,
int mouseButton)
Called when mouse is clicked, regardless as to whether it is over this button or not.
|
void |
moveCursorBy(int num)
Moves the text cursor by a specified number of characters and clears the selection
|
void |
setCanLoseFocus(boolean canLoseFocusIn)
Sets whether this text box loses focus when something other than it is clicked.
|
void |
setCursorPosition(int pos)
Sets the current position of the cursor.
|
void |
setCursorPositionEnd()
Moves the cursor to the very end of this text box.
|
void |
setCursorPositionZero()
Moves the cursor to the very start of this text box.
|
void |
setDisabledTextColour(int color)
Sets the color to use for text in this text box when this text box is disabled.
|
void |
setEnableBackgroundDrawing(boolean enableBackgroundDrawingIn)
Sets whether or not the background and outline of this text box should be drawn.
|
void |
setEnabled(boolean enabled)
Sets whether this text box is enabled.
|
void |
setFocused(boolean isFocusedIn)
Sets focus to this gui element
|
void |
setGuiResponder(GuiPageButtonList.GuiResponder guiResponderIn)
Sets the GuiResponder associated with this text box.
|
void |
setMaxStringLength(int length)
Sets the maximum length for the text in this text box.
|
void |
setResponderEntryValue(int idIn,
java.lang.String textIn)
Notifies this text box's responder that the text has changed.
|
void |
setSelectionPos(int position)
Sets the position of the selection anchor (the selection anchor and the cursor position mark the edges of the
selection).
|
void |
setText(java.lang.String textIn)
Sets the text of the textbox, and moves the cursor to the end.
|
void |
setTextColor(int color)
Sets the color to use when drawing this text box's text.
|
void |
setValidator(<any> theValidator) |
void |
setVisible(boolean isVisible)
Sets whether or not this textbox is visible
|
boolean |
textboxKeyTyped(char typedChar,
int keyCode)
Call this method from your GuiScreen to process the keys into the textbox
|
void |
updateCursorCounter()
Increments the cursor counter
|
void |
writeText(java.lang.String textToWrite)
Adds the given text after the cursor, or replaces the currently selected text if there is a selection.
|
drawCenteredString, drawGradientRect, drawHorizontalLine, drawModalRectWithCustomSizedTexture, drawRect, drawScaledCustomSizeModalRect, drawString, drawTexturedModalRect, drawTexturedModalRect, drawTexturedModalRect, drawVerticalLine
public int xPosition
public int yPosition
public int width
public int height
public GuiTextField(int componentId, FontRenderer fontrendererObj, int x, int y, int par5Width, int par6Height)
public void setGuiResponder(GuiPageButtonList.GuiResponder guiResponderIn)
public void updateCursorCounter()
public void setText(java.lang.String textIn)
public java.lang.String getText()
public java.lang.String getSelectedText()
public void setValidator(<any> theValidator)
public void writeText(java.lang.String textToWrite)
public void setResponderEntryValue(int idIn, java.lang.String textIn)
public void deleteWords(int num)
public void deleteFromCursor(int num)
public int getId()
public int getNthWordFromCursor(int numWords)
public int getNthWordFromPos(int n, int pos)
public int getNthWordFromPosWS(int n, int pos, boolean skipWs)
public void moveCursorBy(int num)
public void setCursorPosition(int pos)
public void setCursorPositionZero()
public void setCursorPositionEnd()
public boolean textboxKeyTyped(char typedChar, int keyCode)
public void mouseClicked(int mouseX, int mouseY, int mouseButton)
public void drawTextBox()
public void setMaxStringLength(int length)
public int getMaxStringLength()
public int getCursorPosition()
public boolean getEnableBackgroundDrawing()
public void setEnableBackgroundDrawing(boolean enableBackgroundDrawingIn)
public void setTextColor(int color)
public void setDisabledTextColour(int color)
public void setFocused(boolean isFocusedIn)
public boolean isFocused()
public void setEnabled(boolean enabled)
public int getSelectionEnd()
public int getWidth()
public void setSelectionPos(int position)
public void setCanLoseFocus(boolean canLoseFocusIn)
public boolean getVisible()
public void setVisible(boolean isVisible)