@Environment(value=CLIENT) public class TextFieldWidget extends AbstractButtonWidget implements Drawable, Element
| Modifier and Type | Field and Description |
|---|---|
private Consumer<String> |
changedListener |
private boolean |
editable |
private int |
editableColor |
private int |
firstCharacterIndex |
private boolean |
focused |
private int |
focusedTicks |
private boolean |
focusUnlocked |
private int |
maxLength |
private BiFunction<String,Integer,String> |
renderTextProvider |
private boolean |
selecting |
private int |
selectionEnd |
private int |
selectionStart |
private String |
suggestion |
private String |
text |
private Predicate<String> |
textPredicate |
private TextRenderer |
textRenderer |
private int |
uneditableColor |
active, alpha, height, hovered, nextNarration, visible, WIDGETS_LOCATION, width, x, yBACKGROUND_TEXTURE, GUI_ICONS_TEXTURE, STATS_ICON_TEXTURE| Constructor and Description |
|---|
TextFieldWidget(TextRenderer textRenderer,
int x,
int y,
int width,
int height,
Text text) |
TextFieldWidget(TextRenderer textRenderer,
int x,
int y,
int width,
int height,
TextFieldWidget copyFrom,
Text text) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
changeFocus(boolean lookForwards) |
boolean |
charTyped(char chr,
int keyCode) |
private void |
drawSelectionHighlight(int x1,
int y1,
int x2,
int y2) |
private void |
erase(int offset) |
void |
eraseCharacters(int characterOffset) |
void |
eraseWords(int wordOffset) |
int |
getCharacterX(int index) |
int |
getCursor() |
int |
getInnerWidth() |
private int |
getMaxLength() |
protected MutableText |
getNarrationMessage() |
String |
getSelectedText() |
String |
getText() |
int |
getWordSkipPosition(int wordOffset) |
private int |
getWordSkipPosition(int wordOffset,
int cursorPosition) |
private int |
getWordSkipPosition(int wordOffset,
int cursorPosition,
boolean skipOverSpaces) |
private boolean |
hasBorder() |
boolean |
isActive() |
private boolean |
isEditable() |
boolean |
isMouseOver(double mouseX,
double mouseY) |
boolean |
isVisible() |
boolean |
keyPressed(int keyCode,
int scanCode,
int modifiers) |
private int |
method_27537(int int2) |
boolean |
mouseClicked(double mouseX,
double mouseY,
int button) |
void |
moveCursor(int offset) |
private void |
onChanged(String newText) |
protected void |
onFocusedChanged(boolean bool) |
void |
renderButton(MatrixStack matrices,
int mouseX,
int mouseY,
float delta) |
void |
setChangedListener(Consumer<String> changedListener) |
void |
setCursor(int cursor) |
void |
setCursorToEnd() |
void |
setCursorToStart() |
void |
setEditable(boolean editable) |
void |
setEditableColor(int color) |
void |
setFocusUnlocked(boolean focusUnlocked) |
void |
setHasBorder(boolean hasBorder) |
void |
setMaxLength(int maxLength) |
void |
setRenderTextProvider(BiFunction<String,Integer,String> renderTextProvider) |
void |
setSelected(boolean selected) |
void |
setSelectionEnd(int int2) |
void |
setSelectionStart(int cursor) |
void |
setSuggestion(String suggestion) |
void |
setText(String text) |
void |
setTextPredicate(Predicate<String> textPredicate) |
void |
setUneditableColor(int color) |
void |
setVisible(boolean visible) |
void |
setX(int x) |
void |
tick() |
void |
write(String string) |
clicked, getHeight, getMessage, getWidth, getYImage, isFocused, isHovered, isValidClickButton, mouseDragged, mouseReleased, narrate, onClick, onDrag, onRelease, playDownSound, queueNarration, render, renderBg, renderToolTip, setAlpha, setFocused, setMessage, setWidthdrawCenteredString, drawCenteredText, drawHorizontalLine, drawSprite, drawStringWithShadow, drawTexture, drawTexture, drawTexture, drawTexture, drawTextWithShadow, drawVerticalLine, fill, fillGradient, fillGradient, getZOffset, method_29343, setZOffsetclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitkeyReleased, mouseDragged, mouseMoved, mouseReleased, mouseScrolledprivate final TextRenderer textRenderer
private String text
private int maxLength
private int focusedTicks
private boolean focused
private boolean focusUnlocked
private boolean editable
private boolean selecting
private int firstCharacterIndex
private int selectionStart
private int selectionEnd
private int editableColor
private int uneditableColor
private String suggestion
private BiFunction<String,Integer,String> renderTextProvider
public TextFieldWidget(TextRenderer textRenderer, int x, int y, int width, int height, Text text)
public TextFieldWidget(TextRenderer textRenderer, int x, int y, int width, int height, @Nullable TextFieldWidget copyFrom, Text text)
public void setRenderTextProvider(BiFunction<String,Integer,String> renderTextProvider)
public void tick()
protected MutableText getNarrationMessage()
getNarrationMessage in class AbstractButtonWidgetpublic void setText(String text)
public String getText()
public String getSelectedText()
public void write(String string)
private void onChanged(String newText)
private void erase(int offset)
public void eraseWords(int wordOffset)
public void eraseCharacters(int characterOffset)
public int getWordSkipPosition(int wordOffset)
private int getWordSkipPosition(int wordOffset,
int cursorPosition)
private int getWordSkipPosition(int wordOffset,
int cursorPosition,
boolean skipOverSpaces)
public void moveCursor(int offset)
private int method_27537(int int2)
public void setCursor(int cursor)
public void setSelectionStart(int cursor)
public void setCursorToStart()
public void setCursorToEnd()
public boolean keyPressed(int keyCode,
int scanCode,
int modifiers)
keyPressed in interface Elementpublic boolean isActive()
public boolean charTyped(char chr,
int keyCode)
public boolean mouseClicked(double mouseX,
double mouseY,
int button)
mouseClicked in interface ElementmouseClicked in class AbstractButtonWidgetpublic void setSelected(boolean selected)
public void renderButton(MatrixStack matrices, int mouseX, int mouseY, float delta)
renderButton in class AbstractButtonWidgetprivate void drawSelectionHighlight(int x1,
int y1,
int x2,
int y2)
public void setMaxLength(int maxLength)
private int getMaxLength()
public int getCursor()
private boolean hasBorder()
public void setHasBorder(boolean hasBorder)
public void setEditableColor(int color)
public void setUneditableColor(int color)
public boolean changeFocus(boolean lookForwards)
changeFocus in interface ElementchangeFocus in class AbstractButtonWidgetpublic boolean isMouseOver(double mouseX,
double mouseY)
isMouseOver in interface ElementisMouseOver in class AbstractButtonWidgetprotected void onFocusedChanged(boolean bool)
onFocusedChanged in class AbstractButtonWidgetprivate boolean isEditable()
public void setEditable(boolean editable)
public int getInnerWidth()
public void setSelectionEnd(int int2)
public void setFocusUnlocked(boolean focusUnlocked)
public boolean isVisible()
public void setVisible(boolean visible)
public int getCharacterX(int index)
public void setX(int x)