且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

表模型更新+ fireTableDataChanged()中断表选择

更新时间:2023-12-03 13:15:34

fireTableDataChanged()告诉表数据可能以任何方式发生了变化,实际上,您是在整个数据集都发生完全变化时才使用它(例如, ve将所有先前的内容替换为新信息).该表将重新从头开始绘制,也可能会清除选择.

fireTableDataChanged() tells the table that the data may have changed in any way, and essentially you use it when the entire data set has completely changed (e.g. you've replaced all of the previous contents with new information). The table will redraw itself from scratch and may also clear the selection.

请使用更保守的 fireTableCellUpdated(int,int) 并指定由于时间变化(可能在等待时间"列中的所有内容)可能已修改的每个单元格.

Instead, use the more conservative fireTableCellUpdated(int,int) and specify each cell that may have been modified due to the time change (presumably, everything in the "wait time" column).

您还可以使用 fireTableRowsUpdated(int,int) 并指定一次调用中已更新的行的整个范围,但是通常***坚持保守的做法,以最大程度地减少不必要的重绘.

You could also use fireTableRowsUpdated(int,int) and specify the entire range of rows that have been updated in one call, but generally it's better to stick to the conservative side to minimize unnecessary redraws.