I get an error when manipulating the view box of the document on the 
JSVGCanvas.  I do this to "resize" a document:

public void setSize(String width, String height) {
        svgDocument.getDocumentElement().setAttribute(
            SVGConstants.SVG_WIDTH_ATTRIBUTE, width);
        svgDocument.getDocumentElement().setAttribute(
            SVGConstants.SVG_HEIGHT_ATTRIBUTE, height);
        svgDocument.getDocumentElement().setAttribute(
            SVGConstants.SVG_VIEW_BOX_ATTRIBUTE, "0 0 " + width + " " + height);
}

To make things stranger, it only happens when I make the size smaller than it 
currently is.  640x480 -> 800x600 is fine.  Then, going from 800x600 -> 700x600 
causes the error.

Setting the width and height causes no problems, but the line that sets the 
view box causes this error to pop-up in the JSVGCanvas:

java.lang.NullPointerException
 at java.awt.geom.AffineTransform.<init>(AffineTransform.java:395)
 at 
org.apache.batik.bridge.SVGSVGElementBridge.handleDOMAttrModifiedEvent(Unknown 
Source)
 at 
org.apache.batik.bridge.BridgeContext$DOMAttrModifiedEventListener.handleEvent(Unknown
 Source)
 at org.apache.batik.dom.events.EventSupport.fireEventListeners(Unknown Source)
 at org.apache.batik.dom.events.EventSupport.fireEventListeners(Unknown Source)
 at org.apache.batik.dom.events.EventSupport.dispatchEvent(Unknown Source)
 at org.apache.batik.dom.AbstractNode.dispatchEvent(Unknown Source)
 at org.apache.batik.dom.AbstractElement.fireDOMAttrModifiedEvent(Unknown 
Source)
 at org.apache.batik.dom.AbstractAttr.setNodeValue(Unknown Source)
 at org.apache.batik.dom.AbstractAttr.setValue(Unknown Source)
 at org.apache.batik.dom.AbstractElement.setAttribute(Unknown Source)
 at 
mil.jfcom.cie.whiteboard.ui.managers.SVGDocumentManager.setSize(SVGDocumentManager.java:137)
 at 
mil.jfcom.cie.whiteboard.ui.runnables.ResizeRunnable.run(ResizeRunnable.java:75)
 at org.apache.batik.util.RunnableQueue.run(Unknown Source)
 at java.lang.Thread.run(Thread.java:595)

Michael Bishop

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to