xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andy Lowther" <...@quantumleap.us>
Subject RE: Update of JSVGCanvas
Date Wed, 05 Jan 2005 16:53:08 GMT
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

        try {
        catch (InterruptedException ex) {}

        runnable = new Runnable() {
            public void run() {
                // code that undoes the change            }


-----Original Message-----
From: TJ Teegan [mailto:tjteegan@hotmail.com] 
Sent: Wednesday, January 05, 2005 11:31 AM
To: batik-users@xml.apache.org
Subject: RE: Update of JSVGCanvas


I am not quite sure if I fully understand the question, so I am just
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
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
the canvas's update thread.  For example:

//Some timer event code.....

    invokeLater(new Runnable() {
        public void run() {

//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 

Hope it helps,

PS: I am not an expert at using Batik, so there may be a better solution
your problem than what I am suggesting.

>From: Scheit Christoph <christoph.scheit@siemens.com>
>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 
>his stroke and stroke color for 5 seconds e.g..
>My Idea to this was to start a thread, which manipulates the attributes
>the element, waits for five sec. and then undo's the manipulations.
>didn't work and I found the answer to this in the FAQ's. Now I start
>Thread like this:
>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
>see the changes...
>Any suggestions what to do?

Don't just search. Find. Check out the new MSN Search! 

To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org

To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org

View raw message