Reputation: 53
I've got a java.util.List bind to a JTable, if I want to refresh the table using
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
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
look at SwingWorker and JProgressBars
same way inside Runnable#Thread
and output to the GUI must be wrapped into invokeLater()
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