I want to assert a com.google.gwt.event.dom.client.KeyPressEvent
. It should match any characters or digits, and signs like ,.-+~ etc.
Especially I want to exclude all "navigation" keys like arrows, insert, delete, pos1, end, F1-12 etc.
Why does the following not work?
KeyPressEvent keyEvent;
if (Character.isLetterOrDigit((int) keyEvent.getUnicodeCharCode()) {}
Result:
The method isLetterOrDigit(char) in the type Character is not applicable for the arguments (int)
Character.isLetterOrDigit(int) is only supported in Java 1.5 or newer. You may be using an older version.
Try casting to a char
instead to match the method signature:
Character.isLetterOrDigit((char)keyEvent.getUnicodeCharCode())