Formatting Integers in JTable Column Cells With Commas

前端 未结 3 1958
说谎
说谎 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:15

    Take a look at Table Format Renderers.

    It provides a simple example of how to create a custom renderer by overriding the setValue(...) method of the renderer.

    Or you can use one of the provided classes which allows you to easily create reusable renderers with different formats.

提交回复
热议问题