user1066163
user1066163

Reputation: 53

JTable binding not permitted

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();

I get this exception:

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

relative to the 2nd line above.

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 is a simple method that I wrote for jProgressBar activation, nothing here is involved in binding.

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

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

Thanks.

Upvotes: 2

Views: 984

Answers (1)

mKorbel
mKorbel

Reputation: 109823

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

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

  • correct way inside Runnable#Thread wrapped into invokeLater()

2) you have two ways

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

Upvotes: 2

Related Questions