I tried the
sample script provided on the Batik web site , but I got the following
error
SVG Error :
'showDialog' not defined
This is the code
that I wrote
// Root
Element
SVGSVGElement
currentRoot = currentSVGDoc.getRootElement()
// create the script
Element elem =
currentSVGDoc.createElementNS(null,
"script");
elem.setAttributeNS(null, "type","text/ecmascript");
Text text = new GenericText("function showDialog(msg) {alert(msg);} " , (AbstractDocument)svgComp.getSVGDocument());
elem.setAttributeNS(null, "type","text/ecmascript");
Text text = new GenericText("function showDialog(msg) {alert(msg);} " , (AbstractDocument)svgComp.getSVGDocument());
elem.appendChild(text);
currentRoot.appendChild(elem);
currentRoot.appendChild(elem);
// create the circle
element
Element circle =
currentSVGDoc.createElementNS(SVGConstants.SVG_NAMESPACE_URI,
"circle");
circle.setAttributeNS(null, "cx", "137.5");
circle.setAttributeNS(null, "r", "20");
circle.setAttributeNS(null, "cy", "110");
circle.setAttributeNS(null, "style", "fill:crimson");
circle.setAttributeNS(null, "onmouseover","showDialog('onmousemove')");
currentRoot.appendChild(circle);circle.setAttributeNS(null, "cx", "137.5");
circle.setAttributeNS(null, "r", "20");
circle.setAttributeNS(null, "cy", "110");
circle.setAttributeNS(null, "style", "fill:crimson");
circle.setAttributeNS(null, "onmouseover","showDialog('onmousemove')");
The sample script
that I used is shown here
Thanks
