Java - Disable scientific notation in JTable cells

自古美人都是妖i 提交于 2019-12-25 17:00:33

问题


I have a JTable where a series of Float are displayed. For small values the cell displays the number in scientific notation. Is there a way to disable that?


回答1:


You should read the following page to get an insight about why it is happening: http://docs.oracle.com/javase/tutorial/uiswing/components/table.html#editrender

Then you should pass your own NumberFormat instance (somehow) in to your JTable, and then all numbers will be formatted properly.

I think it's a good read to read through the entire JTable documentation if you decide to work with it for a long time and I am sure that it is mentioned there how to apply the NumberFormat.



来源:https://stackoverflow.com/questions/20408950/java-disable-scientific-notation-in-jtable-cells

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!