2
I did a project with the LookAndFeel
Substance
, in it I have a thread
which periodically updates a JProgressBar
, the problem is that in function JProgressBar.setValue(1)
and JProgressBar.setMaximum(10)
occurs the exception below:
org.pushingpixels.substance.api.UiThreadingViolationException: Component state change must be done on Event Dispatch Thread
at org.pushingpixels.substance.internal.utils.SubstanceCoreUtilities.testComponentStateChangeThreadingViolation(SubstanceCoreUtilities.java:2072)
at org.pushingpixels.substance.internal.ui.SubstanceProgressBarUI$SubstanceChangeListener.stateChanged(SubstanceProgressBarUI.java:87)
at javax.swing.JProgressBar.fireStateChanged(JProgressBar.java:729)
at javax.swing.JProgressBar$ModelListener.stateChanged(JProgressBar.java:652)
at javax.swing.DefaultBoundedRangeModel.fireStateChanged(DefaultBoundedRangeModel.java:364)
at javax.swing.DefaultBoundedRangeModel.setRangeProperties(DefaultBoundedRangeModel.java:302)
at javax.swing.DefaultBoundedRangeModel.setMaximum(DefaultBoundedRangeModel.java:219)
at javax.swing.JProgressBar.setMaximum(JProgressBar.java:898)
I want to know how I can fix this problem, or maybe how suppress it, as it does not impact on my layout.
http://stackoverflow.com/questions/19695247/substance-lf-not-working
– Renan Gomes
@rrnan on that question he says he corrected by putting on
invokeLater()
, but how do I do it, it seems that this method is to build thethread
that runs the application only I have another to update thecomponent
so I don’t know what it should look like– Gleison
Related: http://answall.com/questions/2017/apply%C3%A7%C3%a3o-swing-by-o-m%C3%a9all-main-should-dispatch-to-create%C3%A7%C3%a3o-da-Gui-to-a-ed? Rq=1
– Victor Stafusa