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;
 }
示例#2
0
 public NumberBox() {
   super.sinkEvents(Event.ONKEYDOWN);
 }