Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JTable not displaying accurate representation of Double

Jeff Weeks
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using a JTable to display a list of mostly String values.
There is one Double, however, that is not being displayed properly. For example:
0.0099 displays as 0.01
0.0166 displays as 0.017
It seems that the JTable is rounding to the nearest thousandth decimal place, but I require full accuracy for this table. Is there a way to force full accuracy when outputing Double values?
If I add the value as a String to the table model, the value is properly displayed, but is no longer a number, nor is it properly right aligned, of course.
Any suggestions?
BTW: I store a copy of the beans used in creating each table row, and can confirm that the original double values are unchanged (and still reflect 0.0099, and 0.0166, for example)
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic