我已经在这里发布了一个类似的问题:Batik IllegalStateException when resizing the JComponent contains the JSVGCanvas。但是,我可以将问题简化为最少的代码集。也许这可以帮助某人找到我的问题。
我从一个线程重复调用以下代码:
//currentComponent is a custom JComponent that contains the JSVGCanvas
if(currentComponent != null && currentComponent.getSvgCanvas().getUpdateManager() != null)
{
try
{
currentComponent.getSvgCanvas().getUpdateManager().getUpdateRunnableQueue().invokeLater(new Runnable()
{
@Override
public void run()
{
resetDocument();
}
private void resetDocument()
{
currentComponent.getSvgCanvas().setDocument(currentComponent.getSvgCanvas().getSVGDocument());
}
});
}
catch(Exception e)
{
System.out.println("Error");
e.printStackTrace();
}
}
有时我会收到以下异常:
java.lang.IllegalStateException: RunnableQueue not started or has exited
at org.apache.batik.util.RunnableQueue.invokeLater(RunnableQueue.java:277)
at java.lang.Thread.run(Unknown Source)
这是蜡染中的错误还是我做错了什么?