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.TextFormatter

    Nested classes/interfaces inherited from class net.minecraft.client.gui.components.AbstractWidget

    net.minecraft.client.gui.components.AbstractWidget.WithInactiveMessage

    Nested 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_STYLE

    Fields inherited from class net.minecraft.client.gui.components.AbstractWidget

    active, alpha, height, isHovered, message, visible, width
  • Constructor Summary

    Constructors
    Constructor
    Description
    TextInputWidget(int x, int y, int width, int height, String initialValue, Consumer<String> changedListener, String suggestion, Predicate<String> textPredicate, int maxLength)
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    extractWidgetRenderState(@NonNull net.minecraft.client.gui.GuiGraphicsExtractor graphics, int mouseX, int mouseY, float a)
     
    Deprecated, for removal: This API element is subject to removal in a future version.
    Due to internal changes in how TextInputWidget works, prefer EditBox.getValue().
    boolean
    Checks if the option is valid.
    void
    Deprecated, for removal: This API element is subject to removal in a future version.
    Due to internal changes in how TextInputWidget works, prefer EditBox.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, updateWidgetNarration

    Methods 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, wrapDefaultNarrationMessage

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface net.minecraft.client.gui.components.events.GuiEventListener

    getBorderForArrowNavigation, getCurrentFocusPath, keyReleased, mouseMoved, mouseScrolled, shouldTakeFocusAfterInteraction

    Methods inherited from interface net.minecraft.client.gui.layouts.LayoutElement

    setPosition

    Methods 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 position
      y - the y position
      width - the width
      height - the height
      initialValue - the initial value
      changedListener - the callback to set the value
      suggestion - the suggestion
      textPredicate - the predicate to check the text
      maxLength - the maximum length of the text
  • Method Details

    • isValid

      public boolean isValid()
      Description copied from interface: CheckedOption
      Checks if the option is valid.
      Specified by:
      isValid in interface CheckedOption
      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:
      extractWidgetRenderState in class net.minecraft.client.gui.components.EditBox
    • getText

      @Deprecated(since="2.2.0", forRemoval=true) public String getText()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Due to internal changes in how TextInputWidget works, prefer EditBox.getValue().
      Get the text value contained within the input box.
      Returns:
      The text value.
    • setText

      @Deprecated(since="2.2.0", forRemoval=true) public void setText(String text)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Due to internal changes in how TextInputWidget works, prefer EditBox.setValue(String).
      Set the text value contained within the input box.
      Parameters:
      text - The text to set.