如果不可见,TableModel 火方法很昂贵 [英] TableModel fire methods expensive if not visible

查看:24
本文介绍了如果不可见,TableModel 火方法很昂贵的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 java swing tablemodel 中,我们可以触发表更改、添加、删除等.我想知道如果组件不可见,这些方法调用是否很昂贵?

in the java swing tablemodel, we are able to fire table changed, added, deleted etc. I am wondering if these method calls are expensive if the component is NOT in visibility?

例如,另一个窗口覆盖了它.或者它位于非活动标签中.

For instance, another window is covering it. Or its in an non-active tab.

推荐答案

为了尽量减少触发大量更新事件的影响,JTable 渲染 使用 享元模式 仅呈现可见单元格.此处概述了该方法.这个相关的示例可以很好地扩展到数千行,但您应该配置文件 以验证所需的性能.

To minimize the impact of firing a large number of update events, JTable renderering uses the flyweight pattern to render only visible cells. The approach is outlined here. This related example scales well into the thousands of rows, but you should profile to verify the desired performance.

我注意到在带有静态文本的视图中,swing 应用程序经常出现延迟,而在隐藏的选项卡组件中有大量表格更新.

I noticed lag in the swing application often on a view with static text, whilst there are heavy table updates in a hidden tab component.

此处所示,使用SwingWorker 来管理不确定的延迟.

As shown here, use SwingWorker to manage indeterminate latency.

这篇关于如果不可见,TableModel 火方法很昂贵的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆