Java JTable sort with TableCellRenderer

≯℡__Kan透↙ 提交于 2019-12-07 05:44:28

The problem is that the formating colors don't reflect the change made by the sort operation.

You have a problem with the logic in your renderer. You are probably accessing data in the table model with the "view row" instead of the "model row".

Since you didn't post your SSCCE demonstrating the problem I can't give you a specific solution only a general solution. Look at the following JTable methods:

convertRowIndexToModel(int viewRowIndex) 
convertRowIndexToView(int modelRowIndex)  

The renderer receives the view row number.

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