Class TextInputWidget
java.lang.Object
net.minecraft.client.gui.components.AbstractWidget
net.minecraft.client.gui.components.EditBox
net.uku3lig.ukulib.config.option.widget.TextInputWidget
- All Implemented Interfaces:
net.minecraft.client.gui.components.events.GuiEventListener, net.minecraft.client.gui.components.Renderable, net.minecraft.client.gui.components.TabOrderedElement, net.minecraft.client.gui.layouts.LayoutElement, net.minecraft.client.gui.narration.NarratableEntry, net.minecraft.client.gui.narration.NarrationSupplier, CheckedOption
- Direct Known Subclasses:
ColorInputWidget
public class TextInputWidget
extends net.minecraft.client.gui.components.EditBox
implements CheckedOption
A widget to input text. Based on
EditBox.-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.client.gui.components.EditBox
net.minecraft.client.gui.components.EditBox.TextFormatterNested classes/interfaces inherited from class net.minecraft.client.gui.components.AbstractWidget
net.minecraft.client.gui.components.AbstractWidget.WithInactiveMessageNested classes/interfaces inherited from interface net.minecraft.client.gui.narration.NarratableEntry
net.minecraft.client.gui.narration.NarratableEntry.NarrationPriority -
Field Summary
Fields inherited from class net.minecraft.client.gui.components.EditBox
BACKWARDS, DEFAULT_HINT_STYLE, DEFAULT_TEXT_COLOR, FORWARDS, SEARCH_HINT_STYLEFields inherited from class net.minecraft.client.gui.components.AbstractWidget
active, alpha, height, isHovered, message, visible, width -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidextractWidgetRenderState(@NonNull net.minecraft.client.gui.GuiGraphicsExtractor graphics, int mouseX, int mouseY, float a) getText()Deprecated, for removal: This API element is subject to removal in a future version.booleanisValid()Checks if the option is valid.voidDeprecated, for removal: This API element is subject to removal in a future version.Due to internal changes in howTextInputWidgetworks, preferEditBox.setValue(String).Methods inherited from class net.minecraft.client.gui.components.EditBox
addFormatter, canConsumeInput, capturesInput, charTyped, createNarrationMessage, deleteChars, deleteCharsToPos, deleteWords, getCursorPosition, getHighlighted, getInnerWidth, getScreenX, getValue, getWordPosition, insertText, isBordered, isVisible, keyPressed, moveCursor, moveCursorTo, moveCursorToEnd, moveCursorToStart, onClick, onDrag, playDownSound, preeditUpdated, setBordered, setCanLoseFocus, setCentered, setCursorPosition, setEditable, setFocused, setHighlightPos, setHint, setInvertHighlightedTextColor, setMaxLength, setResponder, setSuggestion, setTextColor, setTextColorUneditable, setTextShadow, setValue, setVisible, setX, setY, updateWidgetNarrationMethods inherited from class net.minecraft.client.gui.components.AbstractWidget
defaultButtonNarrationText, extractRenderState, extractScrollingStringOverContents, extractTooltipForNextRenderPass, getAlpha, getBottom, getHeight, getMessage, getRectangle, getRight, getTabOrderGroup, getWidth, getX, getY, handleCursor, isActive, isFocused, isHovered, isHoveredOrFocused, isMouseOver, isValidClickButton, mouseClicked, mouseDragged, mouseReleased, narrationPriority, nextFocusPath, onRelease, playButtonClickSound, setAlpha, setHeight, setMessage, setRectangle, setSize, setTabOrderGroup, setTooltip, setTooltipDelay, setWidth, updateNarration, visitWidgets, wrapDefaultNarrationMessageMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.client.gui.components.events.GuiEventListener
getBorderForArrowNavigation, getCurrentFocusPath, keyReleased, mouseMoved, mouseScrolled, shouldTakeFocusAfterInteractionMethods inherited from interface net.minecraft.client.gui.layouts.LayoutElement
setPositionMethods inherited from interface net.minecraft.client.gui.narration.NarratableEntry
getNarratables
-
Constructor Details
-
TextInputWidget
public TextInputWidget(int x, int y, int width, int height, String initialValue, Consumer<String> changedListener, String suggestion, Predicate<String> textPredicate, int maxLength) Constructor.- Parameters:
x- the x positiony- the y positionwidth- the widthheight- the heightinitialValue- the initial valuechangedListener- the callback to set the valuesuggestion- the suggestiontextPredicate- the predicate to check the textmaxLength- the maximum length of the text
-
-
Method Details
-
isValid
public boolean isValid()Description copied from interface:CheckedOptionChecks if the option is valid.- Specified by:
isValidin interfaceCheckedOption- Returns:
- true if the option is valid, false otherwise
-
extractWidgetRenderState
public void extractWidgetRenderState(@NonNull net.minecraft.client.gui.GuiGraphicsExtractor graphics, int mouseX, int mouseY, float a) - Overrides:
extractWidgetRenderStatein classnet.minecraft.client.gui.components.EditBox
-
getText
Deprecated, for removal: This API element is subject to removal in a future version.Due to internal changes in howTextInputWidgetworks, preferEditBox.getValue().Get the text value contained within the input box.- Returns:
- The text value.
-
setText
Deprecated, for removal: This API element is subject to removal in a future version.Due to internal changes in howTextInputWidgetworks, preferEditBox.setValue(String).Set the text value contained within the input box.- Parameters:
text- The text to set.
-
TextInputWidgetworks, preferEditBox.getValue().