public final class TextInputConfig
- Object
- TextInputConfig
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.
Fields
public static final int ACTION_DEFAULT = 0 | The action label shown on the keyboard’s return key: a plain newline / carriage return. |
public static final int ACTION_DONE = 1 | The action label shown on the keyboard’s return key: a “done” affordance that finishes editing. |
public static final int ACTION_NEXT = 2 | The action label shown on the keyboard’s return key: a “next” affordance moving to the next field. |
public static final int ACTION_SEARCH = 3 | The action label shown on the keyboard’s return key: a “search” affordance. |
public static final int ACTION_SEND = 4 | The action label shown on the keyboard’s return key: a “send” affordance. |
Constructors
public TextInputConfig() |
Methods
public int getConstraint() | Returns the TextArea style constraint bits describing the keyboard type. |
public TextInputConfig setConstraint(int constraint) | Sets the TextArea style constraint bits describing the keyboard type. |
public boolean isAutoCorrect() | True when the platform should apply autocorrect / predictive text. |
public TextInputConfig setAutoCorrect(boolean autoCorrect) | Enables or disables platform autocorrect / predictive text. |
public boolean isAutoCapitalize() | True when the platform should auto capitalize. |
public TextInputConfig setAutoCapitalize(boolean autoCapitalize) | Enables or disables platform auto capitalization. |
public boolean isMultiline() | True when the editor accepts multiple lines (the return key inserts a newline). |
public TextInputConfig setMultiline(boolean multiline) | Sets whether the editor accepts multiple lines. |
public int getActionType() | Returns the return key action type, one of the ACTION_* constants. |
public TextInputConfig setActionType(int actionType) | Sets the return key action type, one of the ACTION_* constants. |
Inherited methods
Field details
ACTION_DEFAULT
public static final int ACTION_DEFAULT = 0ACTION_DONE
public static final int ACTION_DONE = 1ACTION_NEXT
public static final int ACTION_NEXT = 2ACTION_SEARCH
public static final int ACTION_SEARCH = 3ACTION_SEND
public static final int ACTION_SEND = 4Constructor details
TextInputConfig
public TextInputConfig()Method details
getConstraint
public int getConstraint()TextArea style constraint bits describing the keyboard type.setConstraint
public TextInputConfig setConstraint(int constraint)TextArea style constraint bits describing the keyboard type.Parameters
constraintintone of the
TextAreaconstraint constantsReturns this instance for chaining.
isAutoCorrect
public boolean isAutoCorrect()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()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()setMultiline
public TextInputConfig setMultiline(boolean multiline)Sets whether the editor accepts multiple lines.
Returns this instance for chaining.
getActionType
public int getActionType()ACTION_* constants.setActionType
public TextInputConfig setActionType(int actionType)Sets the return key action type, one of the ACTION_* constants.
Returns this instance for chaining.