2012-06-27 19 views

回答

0

請嘗試下面的代碼。我沒有測試過這個。

new StringFilter("someValue") { 
      @Override 
      protected void fireUpdate() { 
       super.fireUpdate(); 
       List<Component> items = menu.getItems(); 
       if (!items.isEmpty()) { 
        ((Field) items.get(0)).setValue(""); 
       } 
// Not tested this. If the above code is not working try to get the 
textfield instance somehow from the menu and clear it 
      } 

     }; 

如果你想清除只在用戶的按鍵輸入,而不是程序過濾器的值(通過的setValue()),那麼上面將無法正常工作。您必須重寫onFieldKeyUp方法並使用某個調度程序清除它。