Hey all,

I would like to be able to modify the DOM live and propogating the change to
the DOM to the rendered image. I've been experimenting but I've not had any
success. The following is a method that I call when the rendering is done.
The call is made to the "drawRect" and I reset the SVGDocument back to the
canvas. (admittedly this is a brute force method). but it doesn't appear to
actually render anything. Though I do note that the "drawRect" is being
called twice so it does go through the rendering process twice.

I would prefer to modify the DOM directly than use the modified Graphics2D
calls. It gives me better control and better access to the SVG model.

        boolean dirty = true;

        private void drawRect() {

                System.out.println("Draw Rect");

                SVGDocument svgDoc = svgCanvas.getSVGDocument();
                if (svgDoc != null) {
                        if (dirty) {
                                Element rect = svgDoc.createElement("rect");
                                rect.setAttribute("x", "100");
                                rect.setAttribute("y", "100");
                                rect.setAttribute("width", "400");
                                rect.setAttribute("height", "400");
                                rect.setAttribute("fill", "blue");

                                System.out.println(SVGPicture.xmlToString(svgDoc));
                                svgDoc.getRootElement().appendChild(rect);
                                svgCanvas.setSVGDocument(svgDoc);

                                label.setText("Updating");
                                dirty = false;
                        }
                        label.setText("Draw Rect Done.");

                } else {
                        System.out.println("Document Root is null");
                }
        }

Any suggestions?

Cheers,
Jeremy


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

Reply via email to