I'm totally new to GWT so please forgive me if this is an obvious problem.
I have a TextBox from which I want to take a value and round to 3 decimal places and then return the rounded value to the same textbox. This may not be the graceful way but it seems like this should work.
inputValueBox = new TextBox();
double doubleValue = Double.parseDouble(inputValueBox.getText());
doubleValue = (Math.round(doubleValue * 1000))/1000;
I have attempted do to this a number of different ways, the end result is that, in the inputValueBox, all values to the right of the decimal point are reported as zero. So when I take:
(Math.round(0.99283425 * 1000))/1000 I expect to get 0.993. What I end up with is 0.0
What am I missing?
以上就是GWT displaying decimals in a textbox的详细内容，更多请关注web前端其它相关文章！