JTable中绑定不允许 [英] JTable binding not permitted

查看:137
本文介绍了JTable中绑定不允许的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个java.util.List的绑定到一个JTable,如果我想用刷新表

I've got a java.util.List bind to a JTable, if I want to refresh the table using


  1. bindingGroup.unbind();

  2. bindingGroup.bind();

我得到这个异​​常:

异常螺纹线程8java.lang.UnsupportedOperationException:不能调用此方法的管理结合

Exception in thread "Thread-8" java.lang.UnsupportedOperationException: Can not call this method on a managed binding

相对于上面的第二行。

下面更具体的code:

Below more specific code:

    new Thread(
            new Runnable(){
                public void run(){
                    fireProgressBar(true,"working...");
                    controller.doSmoething();
                    fireProgressBar(false,"");   
                    bindingGroup.unbind();
                    bindingGroup.bind();
                    jTable1.revalidate();                        
                }
            }                
            ).start(); 

fireProgressBar是我写的JProgressBar的激活一个简单的方法,这里没有什么是参与结合。

fireProgressBar is a simple method that I wrote for jProgressBar activation, nothing here is involved in binding.

在bindingGroup.bind()调用抛出上述异常。

the bindingGroup.bind() call throws the exception above.

我也试图与SwingUtilities.invokeLater,而不是新的Thread(....)开始();
但我得到了同样的问题。

I tried also with SwingUtilities.invokeLater instead of new Thread(....).start(); but I get the same issue.

感谢。

推荐答案

1)本code一直在做EDT,在其他的手在GUI刷新一个时刻

1) this code is always done in EDT, in other hands in one moment refreshed in the GUI


  • 的Runnable#主题错误的方式,而不使用了的invokeLater()

  • wrong way inside Runnable#Thread without use for invokeLater()

的Runnable#主题裹成的invokeLater()

2)你有两种方式。

里面同样的方式的Runnable#主题并输出到GUI必须被包裹成的invokeLater()

same way inside Runnable#Thread and output to the GUI must be wrapped into invokeLater()

3)在那一刻,你会要能够管理整个阶梯后台任务(S)内的进步,那么你就可以实现了绑定

3) in moment that you'll to able to manage whole stepped progresses inside Background task(s), then you can implements for Binding

这篇关于JTable中绑定不允许的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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