public interface KeyboardTextInput
Modifier and Type | Method and Description |
---|---|
KeyboardTextInput |
setErrorValidator(InputValidator<String> validator)
Sets an input validator for the virtual keyboard.
|
KeyboardTextInput |
setInitialValue(String initialText)
Sets the text which will be displayed when the virtual keyboard is shown.
|
void |
show(JButton component,
KeyboardInputCallback<String> callback)
This method requests the virtual keypad to be shown.
|
void |
show(JLabel component,
KeyboardInputCallback<String> callback)
This method requests the virtual keypad to be shown.
|
void |
show(JTextField component,
KeyboardInputCallback<String> callback)
This method requests the virtual keyboard to be shown.
|
KeyboardTextInput setErrorValidator(InputValidator<String> validator)
Sets an input validator for the virtual keyboard. This validator will be used to validate the input entered
by the user. Some standard validators are available in
InputValidationFactory
.
Specifying an input validator is recommended, but optional.
In caseInputValidator.isValid(Object)
(in this case parameter is String
) returns false
, the accept
button on the virtual keyboard will be disabled and the error message from InputValidator.getMessage(Object)
(parameter is String
) will be shown.validator
- the validator to be used to validate keyboard user input.NullPointerException
- in case the validator is null
.KeyboardTextInput setInitialValue(String initialText)
initialText
- the initial text for the virtual keyboard.void show(JTextField component, KeyboardInputCallback<String> callback)
component
- the JTextField that will be used to define the screen position of the virtual keyboard.
The component must be visible on the screen at the time of showing the keypad.callback
- the callback to be used when the user exits the keyboard by accepting or canceling the input.NullPointerException
- in case any parameter is null
.void show(JLabel component, KeyboardInputCallback<String> callback)
component
- the JLabel that will be used to define the screen position of the virtual keyboard.
The component must be visible on the screen at the time of showing the keypad.callback
- the callback to be used when the user exits the keyboard by accepting or canceling the input.NullPointerException
- in case any parameter is null
.void show(JButton component, KeyboardInputCallback<String> callback)
component
- the JButton that will be used to define the screen position of the virtual keyboard.
The component must be visible on the screen at the time of showing the keypad.callback
- the callback to be used when the user exits the keyboard by accepting or canceling the input.NullPointerException
- in case any parameter is null
.Copyright © 2021. All rights reserved.