Hi all!
I'm trying to add some MouseEvent to my SVG-File. The SVG is generated by SVGGenearator and SVGGraphics2D. I don't use JSVGCanvas. My graphic has a lot of elements all created in Java SVGGraphics2D. In detail I want create a MouseOver, but then I have to register my elements and i have no idea how. Creating the SVG-file I have nothing to do with (the SVGGenerator takes this part).
Is there any possibility to register the elements before creating the SVG through SVGGenerator? Or should I do this after, with something like document.setAttribute...??
I'm not a SVG or Batik expert, so it would be nice if anybody could help me.
Thanks
Florian Kiefer
public class TestSVGGen {
public void paint(Graphics2D g2d) {
g2d.some elements
}
public static void main(String [] args) throws IOException {
// Get a DOMImplementation
DOMImplementation domImpl =
GenericDOMImplementation.getDOMImplementation();
// Create an instance of org.w3c.dom.Document
Document document = domImpl.createDocument(null, "svg", null);
// Create an instance of the SVG Generator
SVGGraphics2D svgGenerator = new SVGGraphics2D(document);
// Ask the test to render into the SVG Graphics2D implementation
TestSVGGen test = new TestSVGGen();
test.paint(svgGenerator);
// Finally, stream out SVG to the standard output using UTF-8
// character to byte encoding
boolean useCSS = true; // we want to use CSS style attribute
Writer out = new OutputStreamWriter(System.out, "UTF-8");
svgGenerator.stream(out, useCSS);
}
}
|
|
|
|
|