I have a field as:
jFormattedTextFieldGrossWeight = new javax.swing.JFormattedTextField();
jFormattedTextFieldGrossWeight.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("#,##0.00"))));
I assign it a BigDecimal value using its setValue() method, and allow the user to modify that value using this textfield.
Then in the lostFocus method, on the line:
jFormattedTextField.commitEdit();
BigDecimal gross = (BigDecimal)this.jFormattedTextFieldGrossWeight.getValue();
I get the following exception:
java.lang.ClassCastException: java.lang.Long cannot be cast to java.math.BigDecimal
Is there anything wrong? How can I modify my code to get rid of this error?