thanks all for the help so far!
the solution of Pablo works for me. although I also have the problem
with CTRL+V. If the user inputs a string like that there is no
cancelKey() possible.
I added a second keyhandler doing this:
inputRufnummer.addKeyUpHandler(new KeyUpHandler() {
public void onKeyUp(KeyUpEvent event) {
if (!inputRufnummer.getText().matches("[0-9]*")) {
sendButton.setEnabled(false);
sendButton.setText("Not a number");
} else {
sendButton.setEnabled(true);
sendButton.setText("Send");
}
}
});
Best solution for me would be if the framework would offer a "number
only" TextBox - but for the moment this solution must suffice.