I added a JSVGScrollPane around my JSVGCanvas.  Now I’m getting random NPEs when dragging an element around the canvas.  This looks thread-related, but my drag and drop code hasn’t changed.  I’m updating the document in the JSVGCanvas’s UpdateManager with a Runnable.  Here’s the stack trace:

 

java.lang.NullPointerException

        at org.apache.batik.swing.JSVGScrollPane.getViewBoxRect(Unknown Source)

        at org.apache.batik.swing.JSVGScrollPane$ScrollListener.updateCompleted(Unknown Source)

        at org.apache.batik.swing.svg.JSVGComponent$12.run(Unknown Source)

        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)

        at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)

        at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)

        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)

        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)

        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)

        at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)

 

Is there something else I need to manage when I have a JSVGScrollPane?  I just wanted to be able to scroll around the canvas when I’m zoomed in.  All I did was wrap the JSVGCanvas in the JSVGScrollPane.  Oddly enough, this error occurs if I don’t even add the JSVGScrollPane to the application.  As long as I call its constructor with the JSVGCanvas as the parameter, the error happens.

 

Michael Bishop

Reply via email to