Formatting Integers in JTable Column Cells With Commas

前端 未结 3 1943
说谎
说谎 2021-01-20 16:56

I have a Price column that displays integers in plain format like 1000000. I would like to know how can I format it with commas without affecting its value when retrieving w

3条回答
  •  孤独总比滥情好
    2021-01-20 17:32

    You should create a custom TableCellRenderer for that column, one that uses a DecimalFormat instance, one that has the setDecimalSeparatorAlwaysShown(true) called on it.

提交回复
热议问题