java - Displaying money in a JTable but preserving the ability to sort as a double -
i have jtable 1 of columns amount in dollars , cents. define tablecolumn double , right justifies , when sorting, sorts double (not string). , good. problem truncates trailing zeros. 100.00 displayed 100 0.00 displayed 0, etc. tried tablecellrenderer although causes money column display trailing zeros, amounts left justified , jtable sees string.
want trailing zeros retained in displays retain data type sorting , right justifying occur. datatype not need double if there better way this.
i found perfect link. worked first time. copy code.
http://tips4java.wordpress.com/2008/10/11/table-format-renderers/
Comments
Post a Comment