Knowledge Base Nr: 00343 numberedit.java - http://www.swe-kaiser.de

Downloads:

Java: GWT: Nur zahleneingabe in textbox erlauben

  
m_tbPhone = new TextBox();
m_tbPhone.addKeyPressHandler(new KeyPressHandler()
{
@Override
public void onKeyPress(KeyPressEvent event)
{
char c = event.getCharCode();

if(!Character.isDigit(c) && !(event.getNativeEvent().getKeyCode() == KeyCodes.KEY_TAB))
((TextBox)event.getSource()).cancelKey();
}
});