public class GuiTextField extends Gui
Modifier and Type | Field and Description |
---|---|
private boolean |
canLoseFocus
if true the textbox can lose focus by clicking elsewhere on the screen
|
private int |
cursorCounter |
private int |
cursorPosition |
private int |
disabledColor |
private boolean |
enableBackgroundDrawing |
private int |
enabledColor |
private com.google.common.base.Predicate<java.lang.String> |
field_175209_y |
private GuiPageButtonList.GuiResponder |
field_175210_x |
private FontRenderer |
fontRendererInstance |
private int |
height |
private int |
id |
private boolean |
isEnabled
If this value is true along with isFocused, keyTyped will process the keys.
|
private boolean |
isFocused
If this value is true along with isEnabled, keyTyped will process the keys.
|
private int |
lineScrollOffset
The current character index that should be used as start of the rendered text.
|
private int |
maxStringLength |
private int |
selectionEnd
other selection position, maybe the same as the cursor
|
private java.lang.String |
text
Has the current text being edited on the textbox.
|
private boolean |
visible
True if this textbox is visible
|
private int |
width
The width of this text field.
|
int |
xPosition |
int |
yPosition |
icons, optionsBackground, statIcons, 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 p_146175_1_)
delete the selected text, otherwsie deletes characters from either side of the cursor.
|
void |
deleteWords(int p_146177_1_)
Deletes the specified number of words starting at the cursor position.
|
private void |
drawCursorVertical(int p_146188_1_,
int p_146188_2_,
int p_146188_3_,
int p_146188_4_)
draws the vertical line cursor in the textbox
|
void |
drawTextBox()
Draws the textbox
|
int |
func_146197_a(int p_146197_1_,
int p_146197_2_,
boolean p_146197_3_) |
void |
func_175205_a(com.google.common.base.Predicate<java.lang.String> p_175205_1_) |
void |
func_175207_a(GuiPageButtonList.GuiResponder p_175207_1_) |
int |
getCursorPosition()
returns the current position of the cursor
|
boolean |
getEnableBackgroundDrawing()
get enable drawing background and outline
|
int |
getId() |
int |
getMaxStringLength()
returns the maximum number of character that can be contained in this textbox
|
int |
getNthWordFromCursor(int p_146187_1_)
see @getNthNextWordFromPos() params: N, position
|
int |
getNthWordFromPos(int p_146183_1_,
int p_146183_2_)
gets the position of the nth word.
|
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 p_146192_1_,
int p_146192_2_,
int p_146192_3_)
Args: x, y, buttonClicked
|
void |
moveCursorBy(int p_146182_1_)
Moves the text cursor by a specified number of characters and clears the selection
|
void |
setCanLoseFocus(boolean p_146205_1_)
if true the textbox can lose focus by clicking elsewhere on the screen
|
void |
setCursorPosition(int p_146190_1_)
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 p_146204_1_) |
void |
setEnableBackgroundDrawing(boolean p_146185_1_)
enable drawing background and outline
|
void |
setEnabled(boolean p_146184_1_) |
void |
setFocused(boolean p_146195_1_)
Sets focus to this gui element
|
void |
setMaxStringLength(int p_146203_1_) |
void |
setSelectionPos(int p_146199_1_)
Sets the position of the selection anchor (i.e.
|
void |
setText(java.lang.String p_146180_1_)
Sets the text of the textbox
|
void |
setTextColor(int p_146193_1_)
Sets the text colour for this textbox (disabled text will not use this colour)
|
void |
setVisible(boolean p_146189_1_)
Sets whether or not this textbox is visible
|
boolean |
textboxKeyTyped(char p_146201_1_,
int p_146201_2_)
Call this method from your GuiScreen to process the keys into the textbox
|
void |
updateCursorCounter()
Increments the cursor counter
|
void |
writeText(java.lang.String p_146191_1_)
replaces selected text, or inserts text at the position on the cursor
|
drawCenteredString, drawGradientRect, drawHorizontalLine, drawModalRectWithCustomSizedTexture, drawRect, drawScaledCustomSizeModalRect, drawString, drawTexturedModalRect, drawTexturedModalRect, drawTexturedModalRect, drawVerticalLine
private final int id
private final FontRenderer fontRendererInstance
public int xPosition
public int yPosition
private final int width
private final int height
private java.lang.String text
private int maxStringLength
private int cursorCounter
private boolean enableBackgroundDrawing
private boolean canLoseFocus
private boolean isFocused
private boolean isEnabled
private int lineScrollOffset
private int cursorPosition
private int selectionEnd
private int enabledColor
private int disabledColor
private boolean visible
private GuiPageButtonList.GuiResponder field_175210_x
private com.google.common.base.Predicate<java.lang.String> field_175209_y
public GuiTextField(int componentId, FontRenderer fontrendererObj, int x, int y, int par5Width, int par6Height)
public void func_175207_a(GuiPageButtonList.GuiResponder p_175207_1_)
public void updateCursorCounter()
public void setText(java.lang.String p_146180_1_)
public java.lang.String getText()
public java.lang.String getSelectedText()
public void func_175205_a(com.google.common.base.Predicate<java.lang.String> p_175205_1_)
public void writeText(java.lang.String p_146191_1_)
public void deleteWords(int p_146177_1_)
public void deleteFromCursor(int p_146175_1_)
public int getId()
public int getNthWordFromCursor(int p_146187_1_)
public int getNthWordFromPos(int p_146183_1_, int p_146183_2_)
public int func_146197_a(int p_146197_1_, int p_146197_2_, boolean p_146197_3_)
public void moveCursorBy(int p_146182_1_)
public void setCursorPosition(int p_146190_1_)
public void setCursorPositionZero()
public void setCursorPositionEnd()
public boolean textboxKeyTyped(char p_146201_1_, int p_146201_2_)
public void mouseClicked(int p_146192_1_, int p_146192_2_, int p_146192_3_)
public void drawTextBox()
private void drawCursorVertical(int p_146188_1_, int p_146188_2_, int p_146188_3_, int p_146188_4_)
public void setMaxStringLength(int p_146203_1_)
public int getMaxStringLength()
public int getCursorPosition()
public boolean getEnableBackgroundDrawing()
public void setEnableBackgroundDrawing(boolean p_146185_1_)
public void setTextColor(int p_146193_1_)
public void setDisabledTextColour(int p_146204_1_)
public void setFocused(boolean p_146195_1_)
public boolean isFocused()
public void setEnabled(boolean p_146184_1_)
public int getSelectionEnd()
public int getWidth()
public void setSelectionPos(int p_146199_1_)
public void setCanLoseFocus(boolean p_146205_1_)
public boolean getVisible()
public void setVisible(boolean p_146189_1_)