Thanks very much. I tried the method using a second thread for the unmark-action, which does a good job.
Christoph -----Ursprüngliche Nachricht----- Von: Andy Lowther [mailto:[EMAIL PROTECTED] Gesendet: Mittwoch, 5. Januar 2005 17:53 An: Batik Users Betreff: RE: Update of JSVGCanvas If I recall correctly, The UpdateRunnableQueue calls repaint after each Runnable finishes (unless it's a NoRepaintRunnable). So if your Runnable doesn't finish its run method, it doesn't repaint, hence your behavior. You have to invokeLater a Runnable that makes the change, wait 5 seconds in another Thread, and then invokeLater a Runnable that undoes the change. i.e. You could create an inner class and after a selection is made call new MarkerThread().start(); private class MarkerThread extends Thread { public void run() { Runnable runnable; Runnable = new Runnable() { public void run() { // code that changes attributes } } canvas.getUpdateRunnableQueue().invokeLater(runnable); try { Thread.sleep(5000); } catch (InterruptedException ex) {} runnable = new Runnable() { public void run() { // code that undoes the change } } canvas.getUpdateRunnableQueue().invokeLater(runnable); } } -andy -----Original Message----- From: TJ Teegan [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 05, 2005 11:31 AM To: batik-users@xml.apache.org Subject: RE: Update of JSVGCanvas Hello, I am not quite sure if I fully understand the question, so I am just taking a guess here. Hope it helps. You might want to just use the java.util.Timer, or javax.swing.Timer, to count your five seconds. My guess is the canvas does not like it when you put the thread to sleep in PeriodMarker (just a wild guess). Then call your unmark method from within the canvas's update thread. For example: //Some timer event code..... svgCanvas.getUpdateManager().getUpdateRunnableQueue(). invokeLater(new Runnable() { public void run() { maker.unmark(elem); } }); //End timer code Note that in the example above elem, and most likely marker, will have to be declared as final. This should force your updates to show up on the screen instantly. You might also want to call your mark method from within the canvas's update thread similiar to above. For more information check out http://xml.apache.org/batik/javaScripting.html#Threads Hope it helps, TJ PS: I am not an expert at using Batik, so there may be a better solution to your problem than what I am suggesting. >From: Scheit Christoph <[EMAIL PROTECTED]> >Reply-To: "Batik Users" <batik-users@xml.apache.org> >To: batik-users@xml.apache.org >Subject: Update of JSVGCanvas >Date: Wed, 5 Jan 2005 16:34:10 +0100 > >Hi all! > >I want to enable users to search element within an svg-document, which >works fine. The problem is, that if an element is found, I want it to >change >his stroke and stroke color for 5 seconds e.g.. >My Idea to this was to start a thread, which manipulates the attributes of >the element, waits for five sec. and then undo's the manipulations. This >didn't work and I found the answer to this in the FAQ's. Now I start the >Thread like this: > >getUpdateManager().getUpdateRunnableQueue(). >invokeLater(new PeriodMarker(elem, new MarkerImpl() , 5000)); > >where PeriodMarker is a class implementing Runnable. > >The run-method in PeriodMarker looks like this: > > marker.mark(elemToMark); > try { > // sleep > Thread.sleep(time); > } > catch (InterruptedException ex) { > } > marker.unmark(elemToMark); > >where marker modifies the according attributes. > >What happens is, if I comment the last line out, that after five seconds I >can >see the changes... > >Any suggestions what to do? > > >Thanks, > >Christoph _________________________________________________________________ Don't just search. Find. Check out the new MSN Search! http://search.msn.click-url.com/go/onm00200636ave/direct/01/ --------------------------------------------------------------------- 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]