Class IFTextField

Direct Known Subclasses:
IFPasswordField

public class IFTextField extends GUIComponent
The IFTextField class is used for a simple one-line text field
  • Constructor Details

    • IFTextField

      public IFTextField(String label, int x, int y)
      creates an empty IFTextField with the specified label, with specified position, and a default width of 100 pixels.
      Parameters:
      label - the text field's label
      x - the text field's X location on the screen, relative to the PApplet.
      y - the text filed's Y location on the screen, relative to the PApplet.
    • IFTextField

      public IFTextField(String argLabel, int argX, int argY, int argWidth)
      creates an empty IFTextField with the specified label and with specified position and width.
      Parameters:
      argLabel - the text field's label
      argX - the text field's X location on the screen, relative to the PApplet.
      argY - the text filed's Y location on the screen, relative to the PApplet.
      argWidth - the text field's width
    • IFTextField

      public IFTextField(String argLabel, int argX, int argY, int argWidth, String argContents)
      creates an IFTextField with the specified label, with specified position and width, and with specified contents.
      Parameters:
      argLabel - the text field's label
      argX - the text field's X location on the screen, relative to the PApplet.
      argY - the text filed's Y location on the screen, relative to the PApplet.
      argWidth - the text field's width
      argContents - the default contents of the text field
  • Method Details

    • validUnicode

      public static boolean validUnicode(char b)
    • initWithParent

      public void initWithParent()
      Overrides:
      initWithParent in class GUIComponent
    • getVisiblePortionStart

      public int getVisiblePortionStart()
    • setVisiblePortionStart

      public void setVisiblePortionStart(int VisiblePortionStart)
    • getVisiblePortionEnd

      public int getVisiblePortionEnd()
    • setVisiblePortionEnd

      public void setVisiblePortionEnd(int VisiblePortionEnd)
    • getStartSelect

      public int getStartSelect()
    • setStartSelect

      public void setStartSelect(int StartSelect)
    • getEndSelect

      public int getEndSelect()
    • setEndSelect

      public void setEndSelect(int EndSelect)
    • getCursorPosition

      public int getCursorPosition()
    • setCursorPosition

      public void setCursorPosition(int CursorPos)
    • setValue

      public void setValue(String val)
      sets the contents of the text box and displays the specified string in the text box widget.
      Parameters:
      val - the string to become the text field's contents
    • getValue

      public String getValue()
      returns the string that is displayed in the text area. If the contents have not been initialized, getValue() returns NULL, if the contents have been initialized but not set, it returns an empty string.
      Returns:
      contents the contents of the text field
    • mouseEvent

      public void mouseEvent(MouseEvent e)
      implemented to conform to Processing's mouse event handler requirements. You shouldn't call this method directly, as Processing will forward mouse events to this object directly. mouseEvent() handles mouse clicks, drags, and releases sent from the parent PApplet.
      Overrides:
      mouseEvent in class GUIComponent
      Parameters:
      e - the MouseEvent to handle
    • keyEvent

      public void keyEvent(KeyEvent e)
      receives KeyEvents forwarded to it by the GUIController if the current instance is currently in focus.
      Overrides:
      keyEvent in class GUIComponent
      Parameters:
      e - the KeyEvent to be handled
    • render

      public void render(PGraphics graphics)
      draws the text field, contents, selection, and cursor to the screen.
      Overrides:
      render in class GUIComponent
    • actionPerformed

      public void actionPerformed(GUIEvent e)
      Overrides:
      actionPerformed in class GUIComponent