gpt4 book ai didi

java - 在 getValueAt 上执行查询并异步返回结果

转载 作者:行者123 更新时间:2023-12-02 06:58:36 25 4
gpt4 key购买 nike

我正在实现一个包含大量数据的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 必须包装到 invokeLater

  • SwingWorker,方法 publish(同步)、process(同步)、done 的输出(异步)在 EDT 完成

关于java - 在 getValueAt 上执行查询并异步返回结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16982385/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com