You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by MPalatik <mp...@evs.ru> on 2012/02/16 08:25:58 UTC
Nested Nodes
I am trying an example from
http://xmlgraphics.apache.org/batik/using/dom-api.html#buildsvgdoc
http://xmlgraphics.apache.org/batik/using/dom-api.html#buildsvgdoc but
modify it with this:
rectangle1.setAttributeNS(null, "x", "0");
rectangle1.setAttributeNS(null, "y", "0");
rectangle1.setAttributeNS(null, "width", "100");
rectangle1.setAttributeNS(null, "height", "100");
rectangle1.setAttributeNS(null, "fill", "red");
Element rectangle2 = doc.createElementNS(svgNS, "rect");
rectangle2.setAttributeNS(null, "x", "30");
rectangle2.setAttributeNS(null, "y", "30");
rectangle2.setAttributeNS(null, "width", "40");
rectangle2.setAttributeNS(null, "height", "40");
rectangle2.setAttributeNS(null, "fill", "blue");
rectangle1.appendChild(rectangle2);
svgRoot.appendChild(rectangle1);
Then i place the document into the JSVGCanvas which is added to a JFrame.
I expected, that i would see a blue rectangle over and inside the red
rectangle,
but see only red one.
What am i doing wrong?
--
View this message in context: http://batik.2283329.n4.nabble.com/Nested-Nodes-tp4393178p4393178.html
Sent from the Batik - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
Re: Nested Nodes
Posted by MPalatik <mp...@evs.ru>.
Well, the main problem was my inexperience with SVG.
Problem solved.
Element g = doc.createElementNS(svgNS, "g")
g.appendChild(rectangle1);
g.appendChild(rectangle2);
svgRoot.appendChild(g);
--
View this message in context: http://batik.2283329.n4.nabble.com/Nested-Nodes-tp4393178p4393200.html
Sent from the Batik - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org