2011-03-21 62 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