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.
I need to represent floats in jTable formatted. When I do tbl.model.add_row [obj, 1.3524632478].to_java
Share
Ruby classes are converted to java classes when rows being vectorized. I added to_s method to java’s Float class and its OK