Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Swing / AWT / SWT and the fly likes JTable not displaying accurate representation of Double Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTable not displaying accurate representation of Double" Watch "JTable not displaying accurate representation of Double" New topic
Author

JTable not displaying accurate representation of Double

Jeff Weeks
Greenhorn

Joined: Nov 17, 2003
Posts: 6
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)
 
jQuery in Action, 2nd edition
 
subject: JTable not displaying accurate representation of Double
 
Similar Threads
JTable
Working with Jtable
JTable
JTable ........
Help updating cells in a JTable