0
我需要製作自定義文本字段,該字段將根據本地格式化方式格式化數值。所以我做了一個CLAS:JFormattedTextField中的IllegalArgumentException
public class NumberTextField extends JFormattedTextField
{...
構造看起來像這樣:
public NumberTextField()
{
formater=new NumberFormatter();
formater.setAllowsInvalid(false);
nf=NumberFormat.getInstance();
formater.setFormat(nf);
this.setFormatter(formater);
}
它與結束:
由於谷歌無法提供的東西有用,我想看看你能說些什麼呢?也許它沒有價值,以應付 - 我試圖把在構造this.setValue(new Double(0.0d));
或this.setText("0");
- 它並沒有幫助..
nope ...嘗試了你的代碼,複製粘貼它,仍然是同樣的錯誤。使用BlankAsNullNumberFormatter(Class <?extends Number> numberKlazz)實例化它,所以實際上我不知道它是否具有格式,也會嘗試檢查那個。 – 2009-07-06 09:24:30