This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JTable not displaying accurate representation of Double

 
Jeff Weeks
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
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