2012-04-02 20 views

回答

0

您可以編輯自定義字段以使其失效。假設你想在自定義字段中設置文本。你做

field.setText("Test"); 

的setText應該

public void setText(String text) 
{ 
this.text=text; 
invalidate(); 
} 

通過這種方式,你可以作廢剛剛的CustomField,只有將重新粉刷

+0

感謝先生,其改變工作的偉大一次在管理器中的一個字段的內容,但如果我想在同一時間將它應用於多個字段,那麼它不能正常工作。爲什麼?它背後的原因是什麼? – 1001 2012-04-02 15:23:58

+0

你是如何嘗試將它應用於多個領域的?請發佈代碼 – rfsk2010 2012-04-02 15:32:00

+0

hello sir plz快速回復我的代碼 – 1001 2012-04-04 06:43:16

0
 public void flashScreen(){ 
    new Thread(){public void run(){ 
      try{ 
       int alertLevelColor[]=new int[bedList.size()]; 

       for(int i=0;i<3;i++){ 
        for(int j=0;j<bedList.size();j++){ 
         BedInfo bedInfo= (BedInfo)bedList.elementAt(j); 
         if(bedInfo.isFlash){ 
          BedField bdField=(BedField)vfm.getField(j); 
          alertLevelColor[j]=bedInfo.alertLevelColor; 
          bdField.rePaintField(MvisumAlertMain.appMain.loginUser.backgroundColor); 
         } 
        } 
        Thread.currentThread().sleep(300); 
        for(int k=0;k<bedList.size();k++){ 
         BedInfo bedInfo=(BedInfo)bedList.elementAt(k); 
          if(bedInfo.isFlash){ 
          BedField bdField=(BedField)vfm.getField(k); 
          bdField.rePaintField(alertLevelColor[k]); 
         } 
        } 
        Thread.currentThread().sleep(300); 
       } 
      //} 
      }catch(Exception e){ 
       MvisumAlertUtil.saveException("BedListScreen","Flash Screen",e.toString()); 
      } 
     }}.start(); 
} 
+0

上面是代碼片段,我想同時重新打印3-4字段,因此請檢查代碼。 – 1001 2012-04-03 13:00:04