Thank you for your reply. I have modified my ActionListener:
button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { UpdateManager um = canvas.getUpdateManager(); um.getUpdateRunnableQueue().invokeLater(new Runnable() { public void run() { resizeCircle(); } }); } }); and put canvas.setDocumentState(JSVGCanvas.ALWAYS_DYNAMIC) *before* canvas.setDocument(doc), as the FAQ says. Now, I only see the *last update* but not the others in between. I also implemented updateStarted and updateCompleted methods of UpdateManagerListener and added it to the canvas. It seems that all the update events are being consolidated into a single event even though I have sleep delays in between the resizings. In my real application, I need to be able to see many dynamic updates to the SVG that occur pretty close together. Is there anything else I can do to get the desired behavior? Any more thoughts would be appreciated. > -----Original Message----- > From: Thomas DeWeese [mailto:[EMAIL PROTECTED] > Sent: Friday, August 08, 2003 4:33 PM > To: Batik Users > Subject: Re: Dynamic JSVGCanvas Updates > > > Hi Grant, > > Please see: http://xml.apache.org/batik/faqs.html#faq-21 > > > Grant Mc Auley wrote: > > Hello, > > > > My simple test program (relevant code below) loads an SVG > file into a > > JSVGCanvas. Clicking a button calls a method that > iteratively resizes a > > circle in the SVG document. > > > > What I am observing is this: > > 1) After clicking the toolbar button, I do not see the circle resize > > unless I move my mouse into the canvas. > > 2) Further, unless I continually move my mouse over the > canvas I do not > > see the iterative resizing. That is, when I continuously move the > > mouse, I see the circle change size every second. When I stop, the > > circle size does not change. When I move again, I see the > updates. If > > I move outside of the canvas I see no updates. > > > > How are canvas updates related to mouse position and > movement? Is there > > something else that I must do to see live or dynamic canvas updates? > > > > > > // ------- Code: > > > > JSVGCanvas canvas = new JSVGCanvas(); > > File f = new File(shapes.svg"); > > String parser = XMLResourceDescriptor.getXMLParserClassName(); > > SAXSVGDocumentFactory factory = new SAXSVGDocumentFactory(parser); > > Document doc = factory.createDocument(f.toURL().toString()); > > canvas.setDocument(doc); > > canvas.setDocumentState(JSVGCanvas.ALWAYS_DYNAMIC); > > > > ... > > > > button.addActionListener(new ActionListener() { > > > > public void actionPerformed(ActionEvent e) { > > Thread t = new Thread(new Runnable() { > > public void run() { > > resizeCircle(); > > } > > }); > > t.start(); > > } > > > > }); > > > > ... > > > > private void resizeCircle() throws DOMException { > > > > SVGDocument doc = canvas.getSVGDocument(); > > Element el = doc.getElementById("circleOne"); > > for (int i = 0; i < 10; i++) { > > > > if (el.getAttribute("r").equals("20")) { // initial value of r > > (radius) is 20 > > el.setAttribute("r", "50"); > > else > > el.setAttribute("r", "20"); > > try { > > Thread.sleep(1000); > > } > > catch (InterruptedException ex) { > > } > > > > } > > > > } > > // ------- > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]