GWT displaying decimals in a textbox

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; inputValueBox.setText(Double.toString(doubleValue)); 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前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准