I have developed a Swing application. When I try to load data, one numeric text field shows 1000000000.00 (which is correct. I will call this field as first field) where as another numeric text field shows 99999997952.00 instead of (100000000000.00. I will call this field as second field).
Also, after loading the data, when I move the cursor on the first field the number remains the same. Now if I take the cursor to the second field and then click on the first field the value changes to 999999979.52.
Both the numeric text fields are DecimalFormat. I create those fields in the following way:
DecimalFormat format = new DecimalFormat("##,###,#######");
NumericTextField field1= new NumericTextField(10,format);
Also I display the fields in the following way:
DecimalFormat formatter = new DecimalFormat("0.00");
field1.setText(formatter .format(new Double(field1Value)))
Can anyone please help me to understand:
- Why the second field shows
99999997952.00
instead of100000000000.00
- Why the first field changes its value to
999999979.52