Hi Sudhakar,

Sudhakar S <[EMAIL PROTECTED]> wrote on 08/22/2006 01:01:53 AM:

> > Please answer this question, or I can't help you: Why do you want 
> > the swing thread to block until the runnable completes?

>   Public static void main(String[] args) {
> 
>   ExApp app = new ExApp();
>   // Changing the SVG Elements attributes
>   ...
>   app.update();  // --------------------(1)
>   // Changing the SVG Elements attributes
>   ...
>   app.update();  // --------------------(2)
>   ...
>   }

> First ?app.update ()? will update/modify the elements? attributes based 
on
> the ?isChanged? flag. Since it is not synchronized with main thread, it 
will
> update and reset the flags based on statements, which are after first
> ?app.update ()?. So the second ?app.update ()? is not updating properly.

   So I am a little confused about this.  First your example shows this
being done in 'Main' which is not the Swing (AWT Event) thread.  There
would not be a problem with the above code using invokeAndWait.  Do you
call the above 'Main' from a Swing/AWT event handler?  If you are calling
this from Swing/AWT, you should be able to move the call to Main 
to another thread. 

   Also the above code doesn't make lots of sense to me. 
Is the code performing an 'animation'?  (change a bunch
of things, redraw, setup the next set of things, redraw, etc).

   Also you say '// Changing the SVG Elements attributes'
however you can't modify the SVG elements outside of the 
UpdateManager thread.  So if you are modifying the DOM
you need to move those modifications into the update runnable.

> Also I need to show the progress bar for completed status. So if it is
> ?synchronized? with main thread, it would be useful for me to resolve 
above
> problems.

   This is typically done by using SwingUtilities.invokeLater to
run code that updates a progress bar.  So after each 'app.update()'
you could use invokeLater to update your progress bar value.



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

Reply via email to