我正在实现一个包含大量数据的swing jtable,我希望在数据模型中的getValueAt时刻加载数据并在单元格中打印“Loading”并稍后返回数据,我不想在 UI 线程中执行查询。有什么想法吗?谢谢。
最佳答案
I am implementing a swing jtable with a huge number of data, i want the data to be loaded at the moment of getValueAt in the data model and print "Loading" in the cell and return the data later, I dont wanna to execute the query in the UI Thread. Any ideas to de that? Thanks
使用工作线程
Runnable#Thread
,输出到 XxxTableModel 必须包装到 invokeLaterSwingWorker
,方法publish
(同步)、process
(同步)、done
的输出(异步)在 EDT 完成
关于java - 在 getValueAt 上执行查询并异步返回结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16982385/