jRuby's Float to represent in JTable's cell

Posted by guai on Stack Overflow See other posts from Stack Overflow or by guai
Published on 2010-05-18T09:21:38Z Indexed on 2010/05/21 7:50 UTC
Read the original article Hit count: 233

Filed under:
|
|

Hello. I need to represent floats in jTable formatted. When I do tbl.model.add_row [obj, 1.3524632478].to_java, obj is represented as it's to_s method's return value, but float do not. Overriding float's to_s method does nothing. I want floats to be formatted like this class Float def to_s sprintf("%.2f", self) end end in all my tables.

© Stack Overflow or respective owner

Related posts about float

Related posts about jtable