JTable dual formatting

I have a JTable with a doubling column. Most of them are in the form x.xxx. Some of them end with 0, and this is omitted, so I have a table right aligned that looks like

1.339
 1.34
1.353
...

Any way to bring 0s to the end or just decimal point or something like that? I would just assign them to strings and spacers 0s this way, but then I would have the problem of comparing strings (1 <15 <2 <25 <3).

+3
source share
2 answers

you can use the renderer as suggested by fd, here is an example here

+6
source

Source: https://habr.com/ru/post/1755228/


All Articles