更新时间:2023-12-03 15:12:10
假设您的数据模型来源于 AbstractTableModel
,你可以明确更新您的模型,并触发抽象父级中实现的适当更新方法。此外,更新必须在 EDT 上进行,通常使用的invokeLater()
。另请参阅 聆听数据更改 和 启动数据更改事件 。
Assuming your data model derives from AbstractTableModel
, you can update your model explicitly and fire the appropriate update method implemented in the abstract parent. Moreover, updates must occur on the EDT, typically using invokeLater()
. See also Listening for Data Changes and Firing Data Change Events.
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
// update model, which should fire the appropriate event
}
});