JTable数据更新闪烁,客户端-服务器模型

发布于 2024-09-18 03:31:57 字数 267 浏览 2 评论 0原文

我知道已经多次讨论过这个问题,但对我来说没有一个有帮助。我有一个通过套接字进行通信的客户端-服务器应用程序。

方法如下:

  1. 客户端向服务器发出请求
  2. 服务器接收请求,进行处理
  3. 通过 XML 返回请求的数据
  4. JTable 更新/填充新的 XML 数据

客户端请求每 5 秒发生一次,因此表闪烁非常频繁。

您认为如何才能解决这个问题,完全停止闪烁并保持频繁更新?

问候

I know many times already talked about this problem but for me non of them helped. I have a client-server application which communicate via sockets.

The method is the following:

  1. Client make a request to the server
  2. Server receive the request, process
  3. Send back the requested data via XML
  4. The JTable update / populate with new XML data

The client request happen every 5th second so the table flickering is very frequent.

What do you think how able to solve this issue, stop the flickering completely and keep frequent update?

Regards

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

番薯 2024-09-25 03:31:58

我想知道这是否可能是线程问题。使用 Swing 时,您需要确保诸如调用服务器之类的任务是在 UI 线程之外的线程上完成的。然后,当您更新表时,这必须位于摆动线程上。

I'm wondering if it could be a threading issue. When working with Swing, you want to make sure that tasks such as making a call to the server are done on a thread other than the UI thread. Then when you update the table, this must be on the swing thread.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文