2011-03-21 102 views

回答

3

你可以嘗試這樣的事情:

public class MyRichTextField extends RichTextField { 

    public MyRichTextField() { 
     super(); 
    } 

    public void setText(String text) { 
     try { 
      int x = Integer.parseInt(text); 
      super.setText("" + x); 
     } catch (NumberFormatException e) { 
      // the text is not a number 
      super.setText(""); 
     } 
    } 
} 
+0

我使用下面的代碼解決了它 – 2011-03-24 09:29:44