Class UIInputBox

All Implemented Interfaces:
UIContextActions, UIFocus, UIKeyFocus, UIMouseFocus, UITabFocus, LXLoopTask
Direct Known Subclasses:
UINumberBox, UIParameterControl, UITextBox

public abstract class UIInputBox extends UIParameterComponent implements UIFocus
  • Field Details

    • enabled

      protected boolean enabled
    • editable

      protected boolean editable
    • mouseEditable

      protected boolean mouseEditable
    • returnKeyEdit

      protected boolean returnKeyEdit
    • editing

      protected volatile boolean editing
    • hasFill

      protected boolean hasFill
    • fillColor

      protected int fillColor
    • fillStyle

      protected UIInputBox.FillStyle fillStyle
  • Constructor Details

    • UIInputBox

      protected UIInputBox()
    • UIInputBox

      protected UIInputBox(float x, float y, float w, float h)
  • Method Details

    • setProgressColor

      public UIInputBox setProgressColor(boolean hasProgressColor)
    • setProgressColor

      public UIInputBox setProgressColor(int progressColor)
    • setProgressColor

      public UIInputBox setProgressColor(UIColor progressColor)
    • setProgressIndicator

      public UIInputBox setProgressIndicator(UIInputBox.ProgressIndicator meter)
    • disableReturnKeyEdit

      public UIInputBox disableReturnKeyEdit()
    • enableReturnKeyEdit

      public UIInputBox enableReturnKeyEdit()
    • disableImmediateEdit

      public UIInputBox disableImmediateEdit()
    • enableImmediateEdit

      public UIInputBox enableImmediateEdit()
    • disableImmediateAppend

      public UIInputBox disableImmediateAppend()
    • enableImmediateAppend

      public UIInputBox enableImmediateAppend()
    • getValueString

      protected abstract String getValueString()
    • saveEditBuffer

      protected abstract void saveEditBuffer(String editBuffer)
    • getEditBuffer

      protected String getEditBuffer()
    • getEditRange

      protected String getEditRange()
    • onEditChange

      protected void onEditChange(String editBuffer)
      Subclasses may override to handle editing changes
      Parameters:
      editBuffer - New value being actively edited
    • onEditFinished

      protected void onEditFinished()
      Subclasses may override to handle when an edit is finished
    • isEditable

      public boolean isEditable()
    • setEditable

      public UIInputBox setEditable(boolean editable)
    • setMouseEditable

      public UIInputBox setMouseEditable(boolean mouseEditable)
    • isEnabled

      public boolean isEnabled()
    • setEnabled

      public UIInputBox setEnabled(boolean enabled)
    • edit

      public void edit()
    • edit

      public void edit(String editBufferValue)
    • editAppend

      protected void editAppend(String append)
    • getInitialEditBufferValue

      protected String getInitialEditBufferValue()
    • onBlur

      protected void onBlur()
      Description copied from class: UIObject
      Subclasses override when element loses focus
      Overrides:
      onBlur in class UIObject
    • getFillWidthNormalized

      protected double getFillWidthNormalized()
    • onDraw

      protected void onDraw(UI ui, VGraphics vg)
      Description copied from class: UI2dComponent
      Subclasses should override this method to perform their drawing functions.
      Overrides:
      onDraw in class UI2dComponent
      Parameters:
      ui - UI context
      vg - Graphics context
    • onDrawText

      public static void onDrawText(UI ui, VGraphics vg, UIInputBox.EditState editState, String rawString, boolean cursor, VGraphics.Align textAlignHorizontal, float x, float y, float width, float height, float availableWidth)
      Horrendous helper method to render an editable text field
      Parameters:
      ui - UI context
      vg - VGraphics object
      editState - The editing state
      rawString - Raw string to render
      cursor - Whether to draw cursor
      textAlignHorizontal -
      x - X offset
      y - Y offset
      width - Available width from x
      height - Available height from y
      availableWidth -
    • isValidCharacter

      protected abstract boolean isValidCharacter(char keyChar)
    • decrementValue

      protected void decrementValue(KeyEvent keyEvent)
      Subclasses may optionally override to decrement value in response to arrows. Decrement is invoked for the left or down arrow keys.
      Parameters:
      keyEvent - Key event
    • incrementValue

      protected void incrementValue(KeyEvent keyEvent)
      Subclasses may optionally override to decrement value in response to arrows. Increment is invoked for the right or up keys.
      Parameters:
      keyEvent - Key event
    • onKeyPressed

      protected void onKeyPressed(KeyEvent keyEvent, char keyChar, int keyCode)
      Description copied from class: UIEventHandler
      Subclasses override to receive key events
      Overrides:
      onKeyPressed in class UIEventHandler
      Parameters:
      keyEvent - Key event
      keyChar - Key character
      keyCode - Key code value
    • incrementMouseValue

      protected void incrementMouseValue(MouseEvent mouseEvent, int offset)
      Subclasses may optionally implement to change value based upon mouse click+drag in the box.
      Parameters:
      mouseEvent - Mouse event
      offset - Units of mouse movement, positive or negative
    • setValueCommand

      protected void setValueCommand(double value)
    • onMousePressed

      protected void onMousePressed(MouseEvent mouseEvent, float mx, float my)
      Description copied from class: UIEventHandler
      Subclasses override to receive mouse events
      Overrides:
      onMousePressed in class UIParameterComponent
      Parameters:
      mouseEvent - Mouse event
      mx - x-coordinate
      my - y-coordinate
    • onMouseReleased

      protected void onMouseReleased(MouseEvent mouseEvent, float mx, float my)
      Description copied from class: UIEventHandler
      Subclasses override to receive mouse events
      Overrides:
      onMouseReleased in class UIParameterComponent
      Parameters:
      mouseEvent - Mouse event
      mx - x-coordinate
      my - y-coordinate
    • onMouseDragged

      protected void onMouseDragged(MouseEvent mouseEvent, float mx, float my, float dx, float dy)
      Description copied from class: UIEventHandler
      Subclasses override to receive mouse events
      Overrides:
      onMouseDragged in class UIEventHandler
      Parameters:
      mouseEvent - Mouse event
      mx - x-coordinate
      my - y-coordinate
      dx - movement in x
      dy - movement in y