JTable数据更新闪烁,客户端-服务器模型
我知道已经多次讨论过这个问题,但对我来说没有一个有帮助。我有一个通过套接字进行通信的客户端-服务器应用程序。
方法如下:
- 客户端向服务器发出请求
- 服务器接收请求,进行处理
- 通过 XML 返回请求的数据
- 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:
- Client make a request to the server
- Server receive the request, process
- Send back the requested data via XML
- 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想知道这是否可能是线程问题。使用 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.