Like AWT, Swing and most other UI toolkits, Pivot is single-threaded. This 
means that all UI calls need to happen on the event dispatch thread, or EDT. 

You can call into the UI thread from a background thread using 
ApplicationContext.queueCallback(). This method is similar to 
SwingUtilities.invokeLater(). It ensures that the Runnable you pass as an 
argument is executed on the EDT. If you wrap your task listener in an instance 
of org.apache.pivot.wtk.TaskAdapter, this will happen automatically.

On Dec 14, 2010, at 4:59 AM, Jérôme Serré wrote:

> Hello,
> 
> When I move the mouse with a modal window is executed in a different thread,
> there is an  event error on the owner window.
> I have attached one image to illustrate my point
> Did I make something wrong ?
> 
> Thanks
> Jérôme
> 
> Code:
> public void startup(final Display display, Map<String, String> properties)
> throws Exception {
> try {
> window.open(display);
> 
>                        …/…
>                        windowActivite.open();
>                        Tache tache = new Tache();
>                        TaskListener<String> taskListener = new
> TaskListener<String>() {
>                                                @Override
>                                                public void
> taskExecuted(Task<String> task) {
> 
> windowActivite.close();
>                                               }
>                                               @Override
>                                               public void
> executeFailed(Task<String> task) {
>                                                                       try {
> 
> windowActivite.close();
> 
> } catch (BizException be) {
> 
> 
> }
>                                                                       }
>                                               };
>                                               tache.execute(new
> TaskAdapter<String>(taskListener));
> 
>                        }catch (Exception e) {                      }
> }
> private class Tache extends Task<String> {
>                        @Override
>                        public String execute() throws
> TaskExecutionException {
>                                               try {
> Somme operations on objects from window
>                                               Catch(){}
>                        }
> }
> 
> 
> Error :
> java.lang.NullPointerException
>                at
> org.apache.pivot.wtk.ApplicationContext$DisplayHost.processMouseMotionEvent(
> ApplicationContext.java:1010)
>                at java.awt.Component.processEvent(Unknown Source)
>                at
> org.apache.pivot.wtk.ApplicationContext$DisplayHost.processEvent(Application
> Context.java:655)
>                at java.awt.Component.dispatchEventImpl(Unknown Source)
>                at java.awt.Component.dispatchEvent(Unknown Source)
>                at java.awt.EventQueue.dispatchEvent(Unknown Source)
>                at
> java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
>                at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown
> Source)
>                at
> java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
>                at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
>                at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
>                at java.awt.EventDispatchThread.run(Unknown Source)
> 
> ____________________________
> La gestion de votre cave
> <http://85.216.59.161:8000/cave> http://85.216.59.161:8000/cave
> 
> <Image8.jpg>

Reply via email to