Class TextField

java.lang.Object
edu.macalester.graphics.GraphicsObject
edu.macalester.graphics.ui.TextField

public class TextField extends GraphicsObject
  • Constructor Details

    • TextField

      public TextField()
  • Method Details

    • getText

      public String getText()
    • setText

      public void setText(String text)
    • onChange

      public void onChange(Consumer<String> callback)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • setBackground

      public void setBackground(Color color)
    • getEmbeddedComponent

      public JComponent getEmbeddedComponent()
      Description copied from class: GraphicsObject
      For internal use only. Supports UI components.
      Overrides:
      getEmbeddedComponent in class GraphicsObject
    • changed

      protected void changed()
      Description copied from class: GraphicsObject
      Triggers a notifications to observers that this object's appearance has changed. Subclasses should call this whenever anything changes that would alter this object's appearance.
      Overrides:
      changed in class GraphicsObject
    • drawInLocalCoordinates

      protected void drawInLocalCoordinates(Graphics2D gc)
      Description copied from class: GraphicsObject
      For internal use. Draws this graphics object on the screen in its local coordinates, without rotation or scaling.
      Specified by:
      drawInLocalCoordinates in class GraphicsObject
    • testHitInLocalCoordinates

      public boolean testHitInLocalCoordinates(double x, double y)
      Description copied from class: GraphicsObject
      Tests whether the given point is inside the boundary or interior of this object’s shape. The point is in this object’s local coordinates.
      Specified by:
      testHitInLocalCoordinates in class GraphicsObject
    • getBounds

      public Rectangle2D getBounds()
      Description copied from class: GraphicsObject
      Returns the bounding box of this graphics object in its local coordinates.
      Specified by:
      getBounds in class GraphicsObject
    • getEqualityAttributes

      protected Object getEqualityAttributes()
      Description copied from class: GraphicsObject
      For internal use only. Used to compute equals() and hashCode(). Returns an object whose equals() and hashCode() methods encompass the subclass-specific values that should be used to compute equality for the whole GraphicsObject.
      Specified by:
      getEqualityAttributes in class GraphicsObject