Package net.minecraft.client.gui.widget
Class TextFieldWidget
- java.lang.Object
-
- net.minecraft.client.gui.AbstractGui
-
- net.minecraft.client.gui.widget.Widget
-
- net.minecraft.client.gui.widget.TextFieldWidget
-
- All Implemented Interfaces:
IGuiEventListener
,IRenderable
public class TextFieldWidget extends Widget implements IRenderable, IGuiEventListener
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
bordered
private boolean
canLoseFocus
private int
cursorPos
private int
displayPos
private java.util.function.Predicate<java.lang.String>
filter
private FontRenderer
font
private java.util.function.BiFunction<java.lang.String,java.lang.Integer,IReorderingProcessor>
formatter
private int
frame
private int
highlightPos
private boolean
isEditable
private int
maxLength
private java.util.function.Consumer<java.lang.String>
responder
private boolean
shiftPressed
private java.lang.String
suggestion
private int
textColor
private int
textColorUneditable
private java.lang.String
value
-
Fields inherited from class net.minecraft.client.gui.widget.Widget
active, alpha, height, isHovered, nextNarration, packedFGColor, UNSET_FG_COLOR, visible, WIDGETS_LOCATION, width, x, y
-
Fields inherited from class net.minecraft.client.gui.AbstractGui
BACKGROUND_LOCATION, GUI_ICONS_LOCATION, STATS_ICON_LOCATION
-
-
Constructor Summary
Constructors Constructor Description TextFieldWidget(FontRenderer p_i232259_1_, int p_i232259_2_, int p_i232259_3_, int p_i232259_4_, int p_i232259_5_, TextFieldWidget p_i232259_6_, ITextComponent p_i232259_7_)
TextFieldWidget(FontRenderer p_i232260_1_, int p_i232260_2_, int p_i232260_3_, int p_i232260_4_, int p_i232260_5_, ITextComponent p_i232260_6_)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canConsumeInput()
boolean
changeFocus(boolean p_231049_1_)
boolean
charTyped(char p_231042_1_, int p_231042_2_)
protected IFormattableTextComponent
createNarrationMessage()
void
deleteChars(int p_146175_1_)
private void
deleteText(int p_212950_1_)
void
deleteWords(int p_146177_1_)
private int
getCursorPos(int p_238516_1_)
int
getCursorPosition()
java.lang.String
getHighlighted()
int
getInnerWidth()
private int
getMaxLength()
int
getScreenX(int p_195611_1_)
java.lang.String
getValue()
int
getWordPosition(int p_146187_1_)
private int
getWordPosition(int p_146183_1_, int p_146183_2_)
private int
getWordPosition(int p_146197_1_, int p_146197_2_, boolean p_146197_3_)
void
insertText(java.lang.String p_146191_1_)
private boolean
isBordered()
private boolean
isEditable()
boolean
isMouseOver(double p_231047_1_, double p_231047_3_)
boolean
isVisible()
boolean
keyPressed(int p_231046_1_, int p_231046_2_, int p_231046_3_)
boolean
mouseClicked(double p_231044_1_, double p_231044_3_, int p_231044_5_)
void
moveCursor(int p_146182_1_)
void
moveCursorTo(int p_146190_1_)
void
moveCursorToEnd()
void
moveCursorToStart()
protected void
onFocusedChanged(boolean p_230995_1_)
private void
onValueChange(java.lang.String p_212951_1_)
void
renderButton(MatrixStack p_230431_1_, int p_230431_2_, int p_230431_3_, float p_230431_4_)
private void
renderHighlight(int p_146188_1_, int p_146188_2_, int p_146188_3_, int p_146188_4_)
void
setBordered(boolean p_146185_1_)
void
setCanLoseFocus(boolean p_146205_1_)
void
setCursorPosition(int p_212422_1_)
void
setEditable(boolean p_146184_1_)
void
setFilter(java.util.function.Predicate<java.lang.String> p_200675_1_)
void
setFocus(boolean p_146195_1_)
void
setFormatter(java.util.function.BiFunction<java.lang.String,java.lang.Integer,IReorderingProcessor> p_195607_1_)
void
setHighlightPos(int p_146199_1_)
void
setMaxLength(int p_146203_1_)
void
setResponder(java.util.function.Consumer<java.lang.String> p_212954_1_)
void
setSuggestion(java.lang.String p_195612_1_)
void
setTextColor(int p_146193_1_)
void
setTextColorUneditable(int p_146204_1_)
void
setValue(java.lang.String p_146180_1_)
void
setVisible(boolean p_146189_1_)
void
setX(int p_212952_1_)
void
tick()
-
Methods inherited from class net.minecraft.client.gui.widget.Widget
clearFGColor, clicked, getFGColor, getHeight, getMessage, getWidth, getYImage, isFocused, isHovered, isValidClickButton, mouseDragged, mouseReleased, narrate, onClick, onDrag, onRelease, playDownSound, queueNarration, render, renderBg, renderToolTip, setAlpha, setFGColor, setFocused, setHeight, setMessage, setWidth
-
Methods inherited from class net.minecraft.client.gui.AbstractGui
blit, blit, blit, blit, blit, blitOutlineBlack, drawCenteredString, drawCenteredString, drawString, drawString, fill, fillGradient, fillGradient, getBlitOffset, hLine, setBlitOffset, vLine
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.minecraft.client.gui.IGuiEventListener
keyReleased, mouseDragged, mouseMoved, mouseReleased, mouseScrolled
-
Methods inherited from interface net.minecraft.client.gui.IRenderable
render
-
-
-
-
Field Detail
-
font
private final FontRenderer font
-
value
private java.lang.String value
-
maxLength
private int maxLength
-
frame
private int frame
-
bordered
private boolean bordered
-
canLoseFocus
private boolean canLoseFocus
-
isEditable
private boolean isEditable
-
shiftPressed
private boolean shiftPressed
-
displayPos
private int displayPos
-
cursorPos
private int cursorPos
-
highlightPos
private int highlightPos
-
textColor
private int textColor
-
textColorUneditable
private int textColorUneditable
-
suggestion
private java.lang.String suggestion
-
responder
private java.util.function.Consumer<java.lang.String> responder
-
filter
private java.util.function.Predicate<java.lang.String> filter
-
formatter
private java.util.function.BiFunction<java.lang.String,java.lang.Integer,IReorderingProcessor> formatter
-
-
Constructor Detail
-
TextFieldWidget
public TextFieldWidget(FontRenderer p_i232260_1_, int p_i232260_2_, int p_i232260_3_, int p_i232260_4_, int p_i232260_5_, ITextComponent p_i232260_6_)
-
TextFieldWidget
public TextFieldWidget(FontRenderer p_i232259_1_, int p_i232259_2_, int p_i232259_3_, int p_i232259_4_, int p_i232259_5_, @Nullable TextFieldWidget p_i232259_6_, ITextComponent p_i232259_7_)
-
-
Method Detail
-
setResponder
public void setResponder(java.util.function.Consumer<java.lang.String> p_212954_1_)
-
setFormatter
public void setFormatter(java.util.function.BiFunction<java.lang.String,java.lang.Integer,IReorderingProcessor> p_195607_1_)
-
tick
public void tick()
-
createNarrationMessage
protected IFormattableTextComponent createNarrationMessage()
- Overrides:
createNarrationMessage
in classWidget
-
setValue
public void setValue(java.lang.String p_146180_1_)
-
getValue
public java.lang.String getValue()
-
getHighlighted
public java.lang.String getHighlighted()
-
setFilter
public void setFilter(java.util.function.Predicate<java.lang.String> p_200675_1_)
-
insertText
public void insertText(java.lang.String p_146191_1_)
-
onValueChange
private void onValueChange(java.lang.String p_212951_1_)
-
deleteText
private void deleteText(int p_212950_1_)
-
deleteWords
public void deleteWords(int p_146177_1_)
-
deleteChars
public void deleteChars(int p_146175_1_)
-
getWordPosition
public int getWordPosition(int p_146187_1_)
-
getWordPosition
private int getWordPosition(int p_146183_1_, int p_146183_2_)
-
getWordPosition
private int getWordPosition(int p_146197_1_, int p_146197_2_, boolean p_146197_3_)
-
moveCursor
public void moveCursor(int p_146182_1_)
-
getCursorPos
private int getCursorPos(int p_238516_1_)
-
moveCursorTo
public void moveCursorTo(int p_146190_1_)
-
setCursorPosition
public void setCursorPosition(int p_212422_1_)
-
moveCursorToStart
public void moveCursorToStart()
-
moveCursorToEnd
public void moveCursorToEnd()
-
keyPressed
public boolean keyPressed(int p_231046_1_, int p_231046_2_, int p_231046_3_)
- Specified by:
keyPressed
in interfaceIGuiEventListener
-
canConsumeInput
public boolean canConsumeInput()
-
charTyped
public boolean charTyped(char p_231042_1_, int p_231042_2_)
- Specified by:
charTyped
in interfaceIGuiEventListener
-
mouseClicked
public boolean mouseClicked(double p_231044_1_, double p_231044_3_, int p_231044_5_)
- Specified by:
mouseClicked
in interfaceIGuiEventListener
- Overrides:
mouseClicked
in classWidget
-
setFocus
public void setFocus(boolean p_146195_1_)
-
renderButton
public void renderButton(MatrixStack p_230431_1_, int p_230431_2_, int p_230431_3_, float p_230431_4_)
- Overrides:
renderButton
in classWidget
-
renderHighlight
private void renderHighlight(int p_146188_1_, int p_146188_2_, int p_146188_3_, int p_146188_4_)
-
setMaxLength
public void setMaxLength(int p_146203_1_)
-
getMaxLength
private int getMaxLength()
-
getCursorPosition
public int getCursorPosition()
-
isBordered
private boolean isBordered()
-
setBordered
public void setBordered(boolean p_146185_1_)
-
setTextColor
public void setTextColor(int p_146193_1_)
-
setTextColorUneditable
public void setTextColorUneditable(int p_146204_1_)
-
changeFocus
public boolean changeFocus(boolean p_231049_1_)
- Specified by:
changeFocus
in interfaceIGuiEventListener
- Overrides:
changeFocus
in classWidget
-
isMouseOver
public boolean isMouseOver(double p_231047_1_, double p_231047_3_)
- Specified by:
isMouseOver
in interfaceIGuiEventListener
- Overrides:
isMouseOver
in classWidget
-
onFocusedChanged
protected void onFocusedChanged(boolean p_230995_1_)
- Overrides:
onFocusedChanged
in classWidget
-
isEditable
private boolean isEditable()
-
setEditable
public void setEditable(boolean p_146184_1_)
-
getInnerWidth
public int getInnerWidth()
-
setHighlightPos
public void setHighlightPos(int p_146199_1_)
-
setCanLoseFocus
public void setCanLoseFocus(boolean p_146205_1_)
-
isVisible
public boolean isVisible()
-
setVisible
public void setVisible(boolean p_146189_1_)
-
setSuggestion
public void setSuggestion(@Nullable java.lang.String p_195612_1_)
-
getScreenX
public int getScreenX(int p_195611_1_)
-
setX
public void setX(int p_212952_1_)
-
-