Class MultiLineEditBox

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

public class MultiLineEditBox extends AbstractScrollWidget
  • Field Details

  • Constructor Details

    • MultiLineEditBox

      public MultiLineEditBox(Font pFont, int pX, int pY, int pWidth, int pHeight, Component pPlaceholder, Component pMessage)
  • Method Details

    • setCharacterLimit

      public void setCharacterLimit(int pCharacterLimit)
    • setValueListener

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

      public void setValue(String pFullText)
    • getValue

      public String getValue()
    • updateWidgetNarration

      public void updateWidgetNarration(NarrationElementOutput pNarrationElementOutput)
      Specified by:
      updateWidgetNarration in class AbstractWidget
    • mouseClicked

      public boolean mouseClicked(double pMouseX, double pMouseY, int pButton)
      Description copied from class: AbstractWidget
      Called when a mouse button is clicked within the GUI element.

      Specified by:
      mouseClicked in interface GuiEventListener
      Overrides:
      mouseClicked in class AbstractScrollWidget
      Parameters:
      pMouseX - the X coordinate of the mouse.
      pMouseY - the Y coordinate of the mouse.
      pButton - the button that was clicked.
      Returns:
      true if the event is consumed, false otherwise.
    • mouseDragged

      public boolean mouseDragged(double pMouseX, double pMouseY, int pButton, double pDragX, double pDragY)
      Description copied from class: AbstractWidget
      Called when the mouse is dragged within the GUI element.

      Specified by:
      mouseDragged in interface GuiEventListener
      Overrides:
      mouseDragged in class AbstractScrollWidget
      Parameters:
      pMouseX - the X coordinate of the mouse.
      pMouseY - the Y coordinate of the mouse.
      pButton - the button that is being dragged.
      pDragX - the X distance of the drag.
      pDragY - the Y distance of the drag.
      Returns:
      true if the event is consumed, false otherwise.
    • keyPressed

      public boolean keyPressed(int pKeyCode, int pScanCode, int pModifiers)
      Called when a keyboard key is pressed within the GUI element.

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

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

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

      protected void renderContents(GuiGraphics pGuiGraphics, int pMouseX, int pMouseY, float pPartialTick)
      Specified by:
      renderContents in class AbstractScrollWidget
    • renderDecorations

      protected void renderDecorations(GuiGraphics pGuiGraphics)
      Overrides:
      renderDecorations in class AbstractScrollWidget
    • getInnerHeight

      public int getInnerHeight()
      Specified by:
      getInnerHeight in class AbstractScrollWidget
    • scrollbarVisible

      protected boolean scrollbarVisible()
      Overrides:
      scrollbarVisible in class AbstractScrollWidget
    • scrollRate

      protected double scrollRate()
      Specified by:
      scrollRate in class AbstractScrollWidget
    • renderHighlight

      private void renderHighlight(GuiGraphics pGuiGraphics, int pMinX, int pMinY, int pMaxX, int pMaxY)
    • scrollToCursor

      private void scrollToCursor()
    • getDisplayableLineCount

      private double getDisplayableLineCount()
    • seekCursorScreen

      private void seekCursorScreen(double pMouseX, double pMouseY)
    • setFocused

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