i changed my code completely...now i would merge 2 svg file into 1 svg file.
i wrote this code:
public JComponent createComponents() {
// Create a panel and add the button, status label and the SVG
canvas.
final JPanel panel = new JPanel(new BorderLayout());
JPanel p = new JPanel(new FlowLayout(FlowLayout.LEFT));
p.add(button);
p.add(label);
p.add(getJSlider(), null);
panel.add("North", p);
panel.add("Center", svgCanvas);
File file1 = new File("batik70.svg");
File file2 = new File("asf-logo.svg");
String parser = XMLResourceDescriptor.getXMLParserClassName ();
SAXSVGDocumentFactory factory = new SAXSVGDocumentFactory(parser);
SVGDocument document1 = null;
SVGDocument document2 = null;
try {
document1 = (SVGDocument)
factory.createDocument(file1.toURL().toString());
document2 = (SVGDocument)
factory.createDocument(file2.toURL().toString());
document1.getDocumentElement().setAttributeNS(null, "id",
"doc1");
document2.getDocumentElement().setAttributeNS(null, "id",
"doc2");
} catch (MalformedURLException e1) {
e1.printStackTrace ();
System.exit(1);
} catch (IOException e1) {
e1.printStackTrace();
System.exit(1);
}
//Copy the document2 inside document 1
Node newDocument =
document1.importNode(document2.getDocumentElement(), true);
//And append the result
document1.getDocumentElement().appendChild(newDocument);
svgCanvas.setDocumentState(JSVGCanvas.ALWAYS_DYNAMIC);
svgCanvas.setSVGDocument(document1);
in this way i include document 2 into document 1...but i need to create a
new document to contain both document, moreover i would labeled document 1
and document 2 with a "id" how then i can modify all document 1 or all
document 2...
--
View this message in context:
http://www.nabble.com/load-2-svg-file-into-1-svgCanvas-tf3492392.html#a9776842
Sent from the Batik - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]