Class TextFieldComponent

java.lang.Object
All Implemented Interfaces:
IRenderable, Tweenable, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.MouseWheelListener, java.util.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, java.lang.String text)
  • Method Details

    • getFormat

      public java.lang.String getFormat()
    • getMaxLength

      public int getMaxLength()
    • getText

      public java.lang.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
    • handleTypedKey

      public void handleTypedKey​(java.awt.event.KeyEvent event)
    • onChangeConfirmed

      public void onChangeConfirmed​(java.util.function.Consumer<java.lang.String> cons)
    • render

      public void render​(java.awt.Graphics2D g)
      Description copied from interface: IRenderable
      Renders the visual contents of this instance onto the provided graphics context.

      If an Entity implements this interface, this method will be called right after the entity was rendered from the environment. Allowing for a custom rendering mechanism.

      This interface can be implemented in general by anything that should be rendered to the game's screen.

      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:
      RenderEngine.renderEntity(Graphics2D, de.gurkenlabs.litiengine.entities.IEntity)
    • setFormat

      public void setFormat​(java.lang.String format)
    • setMaxLength

      public void setMaxLength​(int maxLength)
    • setText

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