Hi Javid,

I did initially try to add the red circles to the svg document
programatically, infact I think you emailed me a snippet of your code but
it doesn't work, the code compiles but does not display the red-circles, I
tried to repaint my canvas, that don't work... here's the code I'm using
maybe you might be able to spot where I'm making the error...


//I added this in my constructor
canvas.setDocumentState(JSVGCanvas.ALWAYS_DYNAMIC);

//The following code I added in my ActionListener triggred by a button

canvas.getUpdateManager().getUpdateRunnableQueue().invokeLater(new
Runnable() {

                      public void run()
                      {
                        SVGDocument doc = canvas.getSVGDocument();
                        String SVGNS = "http://www.w3.org/2000/svg";;
                        Iterator i = spots.iterator();
                        Element g = doc.getElementById("circleGroup");
                       if (g == null)
                       {
                          g = doc.createElementNS(SVGNS,"g");
                          g.setAttributeNS(null, "id", "circleGroup");
                          doc.getRootElement().appendChild(g);
                       }


                        while (i.hasNext())
                        {
                          Point2D pt2d = (Point2D) i.next();
                          Element e = doc.createElementNS(SVGNS,"circle");
                          e.setAttributeNS(null,"cx",""+pt2d.getX());
                          e.setAttributeNS(null,"cy",""+pt2d.getY());
                          e.setAttributeNS(null,"r","8");
                          e.setAttributeNS(null,"fill","Red");
                          g.appendChild(e);
                        }
                      }
                      });

                      canvas.repaint();

Thx inadvance,

yasmin



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

Reply via email to