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: GuiComponent
      Note: If you override this and are modifying swing components, be sure you are in the AWT thread when you do so!
      Specified by:
      render in interface IRenderable
      Overrides:
      render in class ImageComponent
      Parameters:
      g - The current graphics object onto which this instance will render its visual contents.
      See Also:
    • setFlickerDelay

      public void setFlickerDelay(int flickerDelayMillis)