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