private static TextBox createTextBox(boolean isPassword) { TextBox tb; if (isPassword) { tb = new PasswordTextBox() { @Override public void onBrowserEvent(Event event) { super.onBrowserEvent(event); handlePaste(this, event); } }; } else { tb = new TextBox() { @Override public void onBrowserEvent(Event event) { super.onBrowserEvent(event); handlePaste(this, event); } }; } tb.addKeyPressHandler( new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { event.stopPropagation(); } }); tb.sinkEvents(Event.ONPASTE); tb.setVisibleLength(40); return tb; }
public NumberBox() { super.sinkEvents(Event.ONKEYDOWN); }