Class MultiLineEditBox

All Implemented Interfaces:
GuiEventListener, Renderable, TabOrderedElement, LayoutElement, NarratableEntry, NarrationSupplier, IAbstractWidgetExtension

public class MultiLineEditBox extends AbstractTextAreaWidget
  • Field Details

    • CURSOR_INSERT_WIDTH

      private static final int CURSOR_INSERT_WIDTH
      See Also:
    • CURSOR_COLOR

      private static final int CURSOR_COLOR
      See Also:
    • CURSOR_APPEND_CHARACTER

      private static final String CURSOR_APPEND_CHARACTER
      See Also:
    • TEXT_COLOR

      private static final int TEXT_COLOR
      See Also:
    • PLACEHOLDER_TEXT_COLOR

      private static final int PLACEHOLDER_TEXT_COLOR
      See Also:
    • font

      private final Font font
    • placeholder

      private final Component placeholder
    • textField

      private final MultilineTextField textField
    • textColor

      private final int textColor
    • textShadow

      private final boolean textShadow
    • cursorColor

      private final int cursorColor
    • focusedTime

      private long focusedTime
  • Constructor Details

    • MultiLineEditBox

      MultiLineEditBox(Font font, int x, int y, int width, int height, Component placeholder, Component message, int textColor, boolean textShadow, int cursorColor, boolean showBackground, boolean showDecorations)
  • Method Details

    • setCharacterLimit

      public void setCharacterLimit(int characterLimit)
    • setLineLimit

      public void setLineLimit(int lineLimit)
    • setValueListener

      public void setValueListener(Consumer<String> valueListener)
    • setValue

      public void setValue(String value)
    • setValue

      public void setValue(String value, boolean force)
    • getValue

      public String getValue()
    • updateWidgetNarration

      public void updateWidgetNarration(NarrationElementOutput narrationElementOutput)
      Specified by:
      updateWidgetNarration in class AbstractWidget
    • onClick

      public void onClick(double mouseX, double mouseY)
      Overrides:
      onClick in class AbstractWidget
    • onDrag

      protected void onDrag(double mouseX, double mouseY, double dragX, double dragY)
      Overrides:
      onDrag in class AbstractWidget
    • keyPressed

      public boolean keyPressed(int keyCode, int scanCode, int modifiers)
      Called when a keyboard key is pressed within the GUI element.

      Specified by:
      keyPressed in interface GuiEventListener
      Overrides:
      keyPressed in class AbstractTextAreaWidget
      Parameters:
      keyCode - the key code of the pressed key.
      scanCode - the scan code of the pressed key.
      modifiers - the keyboard modifiers.
      Returns:
      true if the event is consumed, false otherwise.
    • charTyped

      public boolean charTyped(char codePoint, int modifiers)
      Called when a character is typed within the GUI element.

      Parameters:
      codePoint - the code point of the typed character.
      modifiers - the keyboard modifiers.
      Returns:
      true if the event is consumed, false otherwise.
    • renderContents

      protected void renderContents(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick)
      Specified by:
      renderContents in class AbstractTextAreaWidget
    • renderDecorations

      protected void renderDecorations(GuiGraphics guiGraphics)
      Overrides:
      renderDecorations in class AbstractTextAreaWidget
    • getInnerHeight

      public int getInnerHeight()
      Specified by:
      getInnerHeight in class AbstractTextAreaWidget
    • scrollRate

      protected double scrollRate()
      Specified by:
      scrollRate in class AbstractScrollArea
    • scrollToCursor

      private void scrollToCursor()
    • seekCursorScreen

      private void seekCursorScreen(double mouseX, double mouseY)
    • setFocused

      public void setFocused(boolean focused)
      Sets the focus state of the GUI element.
      Specified by:
      setFocused in interface GuiEventListener
      Overrides:
      setFocused in class AbstractWidget
      Parameters:
      focused - true to apply focus, false to remove focus
    • builder

      public static MultiLineEditBox.Builder builder()