Reputation: 76
I've tried coming up with a solution to this problem by combining a few separate issues other people posted on this site, but somehow can't get it right.
I receive a BigDecimal from the server which I need to display in a TextBox inside a GWT page.
BigDecimal bigDec = new BigDecimal(type.mb3.toString()).setScale(2, BigDecimal.ROUND_HALF_UP);
t12.setText(bigDec.toString());
After this call the TextBox displays ex. 1200.00
, which is the correct value, however I would like for it to be formatted with a German locale ##0,00
.
I can't convert it by specifying the format via NumberFormat, as it doesn't accept BigDecimal. Is there another way I can format this without writing a neanderthal "if you see dot exchange it for comma" text parser?
Upvotes: 1
Views: 274
Reputation: 76
The comment Thomas Broyer provided was the answer. I needed to use java.lang.Number
instead of pure BigDecimal and it formatted correctly.
Upvotes: 1