Class TextInputConfig

java.lang.Object
com.codename1.ui.TextInputConfig

public final class TextInputConfig extends Object

Immutable configuration handed to the platform when a TextInputClient binds to the low level text input source (see com.codename1.impl.CodenameOneImplementation#startTextInput). It tells the platform which soft keyboard flavor to present and how aggressive autocorrect / autocapitalization should be. A source editor typically disables autocorrect and autocapitalization so it does not mangle code, whereas a prose editor leaves them on.

The constraint constants mirror the TextArea constraint bits so the same keyboard mapping the framework already uses for native fields applies here.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The action label shown on the keyboard's return key: a plain newline / carriage return.
    static final int
    The action label shown on the keyboard's return key: a "done" affordance that finishes editing.
    static final int
    The action label shown on the keyboard's return key: a "next" affordance moving to the next field.
    static final int
    The action label shown on the keyboard's return key: a "search" affordance.
    static final int
    The action label shown on the keyboard's return key: a "send" affordance.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the return key action type, one of the ACTION_* constants.
    int
    Returns the TextArea style constraint bits describing the keyboard type.
    boolean
    True when the platform should auto capitalize.
    boolean
    True when the platform should apply autocorrect / predictive text.
    boolean
    True when the editor accepts multiple lines (the return key inserts a newline).
    setActionType(int actionType)
    Sets the return key action type, one of the ACTION_* constants.
    setAutoCapitalize(boolean autoCapitalize)
    Enables or disables platform auto capitalization.
    setAutoCorrect(boolean autoCorrect)
    Enables or disables platform autocorrect / predictive text.
    setConstraint(int constraint)
    Sets the TextArea style constraint bits describing the keyboard type.
    setMultiline(boolean multiline)
    Sets whether the editor accepts multiple lines.

    Methods inherited from class Object

    clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • ACTION_DEFAULT

      public static final int ACTION_DEFAULT
      The action label shown on the keyboard's return key: a plain newline / carriage return.
      See Also:
    • ACTION_DONE

      public static final int ACTION_DONE
      The action label shown on the keyboard's return key: a "done" affordance that finishes editing.
      See Also:
    • ACTION_NEXT

      public static final int ACTION_NEXT
      The action label shown on the keyboard's return key: a "next" affordance moving to the next field.
      See Also:
    • ACTION_SEND

      public static final int ACTION_SEND
      The action label shown on the keyboard's return key: a "send" affordance.
      See Also:
  • Constructor Details

    • TextInputConfig

      public TextInputConfig()
  • Method Details

    • getConstraint

      public int getConstraint()
      Returns the TextArea style constraint bits describing the keyboard type.
    • setConstraint

      public TextInputConfig setConstraint(int constraint)

      Sets the TextArea style constraint bits describing the keyboard type.

      Parameters
      • constraint: one of the TextArea constraint constants

      Returns this instance for chaining.

    • isAutoCorrect

      public boolean isAutoCorrect()
      True when the platform should apply autocorrect / predictive text.
    • setAutoCorrect

      public TextInputConfig setAutoCorrect(boolean autoCorrect)

      Enables or disables platform autocorrect / predictive text. Disable this for source code.

      Returns this instance for chaining.

    • isAutoCapitalize

      public boolean isAutoCapitalize()
      True when the platform should auto capitalize.
    • setAutoCapitalize

      public TextInputConfig setAutoCapitalize(boolean autoCapitalize)

      Enables or disables platform auto capitalization. Disable this for source code.

      Returns this instance for chaining.

    • isMultiline

      public boolean isMultiline()
      True when the editor accepts multiple lines (the return key inserts a newline).
    • setMultiline

      public TextInputConfig setMultiline(boolean multiline)

      Sets whether the editor accepts multiple lines.

      Returns this instance for chaining.

    • getActionType

      public int getActionType()
      Returns the return key action type, one of the ACTION_* constants.
    • setActionType

      public TextInputConfig setActionType(int actionType)

      Sets the return key action type, one of the ACTION_* constants.

      Returns this instance for chaining.