Examples of InvocationEvent


Examples of java.awt.event.InvocationEvent

        return Thread.currentThread() instanceof EventDispatchThread;
    }

    public static void invokeLater(Runnable runnable) {
        Toolkit toolkit = Toolkit.getDefaultToolkit();
        InvocationEvent event = new InvocationEvent(toolkit, runnable);
        toolkit.getSystemEventQueueImpl().postEvent(event);
    }
View Full Code Here

Examples of java.awt.event.InvocationEvent

            throw new Error();
        }

        final Toolkit toolkit = Toolkit.getDefaultToolkit();
        final Object notifier = new Object()//$NON-LOCK-1$
        InvocationEvent event = new InvocationEvent(
                toolkit, runnable, notifier, true);

        synchronized (notifier) {
            toolkit.getSystemEventQueueImpl().postEvent(event);
            notifier.wait();
        }

        Exception exception = event.getException();

        if (exception != null) {
            throw new InvocationTargetException(exception);
        }
    }
View Full Code Here

Examples of java.awt.event.InvocationEvent

            }
        };
        if (Thread.currentThread() instanceof EventDispatchThread) {
            r.run();
        } else {
            toolkit.getSystemEventQueueImpl().postEvent(new InvocationEvent(this, r));
        }
    }
View Full Code Here

Examples of java.awt.event.InvocationEvent

            }
        };
        if (Thread.currentThread() instanceof EventDispatchThread) {
            r.run();
        } else {
            toolkit.getSystemEventQueueImpl().postEvent(new InvocationEvent(this, r));
        }
    }
View Full Code Here

Examples of java.awt.event.InvocationEvent

     */
    public Object invokeAndWait(QueueAction action) {
 
        class JemmyInvocationLock {}
        Object lock = new JemmyInvocationLock();
        InvocationEvent event =
            new InvocationEvent(Toolkit.getDefaultToolkit(),
                                action,
                                lock,
        true);
  try {
            synchronized (lock) {
                getQueue().postEvent(event);
                lock.wait();
            }
  } catch(InterruptedException e) {
      throw(new JemmyException("InterruptedException during " +
             action.getDescription() +
             " execution", e));
  }
  if(action.getException() != null) {
      throw(new JemmyException("Exception in " + action.getDescription(),
             action.getException()));
  }
  if(event.getException() != null) {
      throw(new JemmyException("Exception in " + action.getDescription(),
             event.getException()));
  }
  return(action.getResult());
    }
View Full Code Here

Examples of java.awt.event.InvocationEvent

                notificationLock.notifyAll(); // Notify caller that we're done
            }
        } };
        synchronized(notificationLock) {
            SunToolkit.postEvent(this,
                new InvocationEvent(Toolkit.getDefaultToolkit(), runnable));
            try {
                notificationLock.wait(DISPOSAL_TIMEOUT);
            } catch (InterruptedException e) { }
        }

        // Next, we post another InvocationEvent to the end of the
        // EventQueue.  When it's executed, we know we've executed all
        // events in the queue.

        runnable = new Runnable() { public void run() {
            synchronized(notificationLock) {
                notificationLock.notifyAll(); // Notify caller that we're done
            }
        } };
        synchronized(notificationLock) {
            SunToolkit.postEvent(this,
                new InvocationEvent(Toolkit.getDefaultToolkit(), runnable));
            try {
                notificationLock.wait(DISPOSAL_TIMEOUT);
            } catch (InterruptedException e) { }
        }
View Full Code Here

Examples of java.awt.event.InvocationEvent

      throw new Error("Can't call invokeAndWait from event dispatch thread");

    EventQueue eq = Toolkit.getDefaultToolkit().getSystemEventQueue();
    Object notifyObject = new Object();

    InvocationEvent ie =
      new InvocationEvent(eq, runnable, notifyObject, true);

    synchronized (notifyObject)
      {
        eq.postEvent(ie);
        notifyObject.wait();
      }

    Exception exception;

    if ((exception = ie.getException()) != null)
      throw new InvocationTargetException(exception);
  }
View Full Code Here

Examples of java.awt.event.InvocationEvent

   */
  public static void invokeLater(Runnable runnable)
  {
    EventQueue eq = Toolkit.getDefaultToolkit().getSystemEventQueue();

    InvocationEvent ie =
      new InvocationEvent(eq, runnable, null, false);

    eq.postEvent(ie);
  }
View Full Code Here

Examples of java.awt.event.InvocationEvent

     */
    public Object invokeAndWait(QueueAction action) {
 
        class JemmyInvocationLock {}
        Object lock = new JemmyInvocationLock();
        InvocationEvent event =
            new InvocationEvent(Toolkit.getDefaultToolkit(),
                                action,
                                lock,
        true);
  try {
            synchronized (lock) {
                getQueue().postEvent(event);
                lock.wait();
            }
  } catch(InterruptedException e) {
      throw(new JemmyException("InterruptedException during " +
             action.getDescription() +
             " execution", e));
  }
  if(action.getException() != null) {
      throw(new JemmyException("Exception in " + action.getDescription(),
             action.getException()));
  }
  if(event.getException() != null) {
      throw(new JemmyException("Exception in " + action.getDescription(),
             event.getException()));
  }
  return(action.getResult());
    }
View Full Code Here

Examples of java.awt.event.InvocationEvent

                }
            }
        };
        // Fix 6255371.
        if (!PaintEventDispatcher.getPaintEventDispatcher().queueSurfaceDataReplacing((Component)target, r)) {
            postEvent(new InvocationEvent(Toolkit.getDefaultToolkit(), r));
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.