Class TextFieldComponent

All Implemented Interfaces:
IRenderable, Tweenable, MouseListener, MouseMotionListener, MouseWheelListener, EventListener
Direct Known Subclasses:
NumberAdjuster

public class TextFieldComponent extends ImageComponent
  • Field Details

  • Constructor Details

    • TextFieldComponent

      public TextFieldComponent(double x, double y, double width, double height, String text)
  • Method Details

    • getFormat

      public String getFormat()
    • setFormat

      public void setFormat(String format)
    • getCursor

      public String getCursor()
    • setCursor

      public void setCursor(String newCursor)
    • getMaxLength

      public int getMaxLength()
    • setMaxLength

      public void setMaxLength(int maxLength)
    • getText

      public String getText()
      Description copied from class: GuiComponent
      Gets the entire Text associated with this GuiComponent. Parts of the Text may get cropped and can therefore be invisible. To retrieve only the visible part of the text, use GuiComponent.getTextToRender(Graphics2D g).
      Overrides:
      getText in class GuiComponent
      Returns:
      the entire text on this GuiComponent
    • setText

      public void setText(String text)
      Description copied from class: GuiComponent
      Sets the text.
      Overrides:
      setText in class GuiComponent
      Parameters:
      text - the new text
    • getTextToRender

      public String getTextToRender(Graphics2D g)
      Description copied from class: GuiComponent
      Gets only the non-cropped bits of Text visible on this GuiComponent.m To retrieve only the entire text associated with this GuiComponent, use GuiComponent.getText().
      Overrides:
      getTextToRender in class GuiComponent
      Parameters:
      g - The graphics object to render on.
      Returns:
      the text to render
    • handleTypedKey

      public void handleTypedKey(KeyEvent event)
    • canHandleInput

      public boolean canHandleInput()
    • onChangeConfirmed

      public void onChangeConfirmed(Consumer<String> cons)
    • render

      public void render(Graphics2D g)
      Description copied from class: ImageComponent
      Renders the component using the provided Graphics2D context. If the component is suspended or not visible, the method returns immediately. Otherwise, it renders the background image (if available) and the main image (if available), and then calls the superclass's render method.
      Specified by:
      render in interface IRenderable
      Overrides:
      render in class ImageComponent
      Parameters:
      g - The Graphics2D context used for rendering.
      See Also:
    • setFlickerDelay

      public void setFlickerDelay(int flickerDelayMillis)