Package java.awt.event

Examples of java.awt.event.InvocationEvent


     * @see             #invokeAndWait
     * @since           1.2
     */
    public static void invokeLater(Runnable runnable) {
        Toolkit.getEventQueue().postEvent(
            new InvocationEvent(Toolkit.getDefaultToolkit(), runnable));
    }
View Full Code Here


        }

  class AWTInvocationLock {}
        Object lock = new AWTInvocationLock();

        InvocationEvent event =
            new InvocationEvent(Toolkit.getDefaultToolkit(), runnable, lock,
        true);

        synchronized (lock) {
            Toolkit.getEventQueue().postEvent(event);
            lock.wait();
        }

        Throwable eventThrowable = event.getThrowable();
        if (eventThrowable != null) {
            throw new InvocationTargetException(eventThrowable);
        }
    }
View Full Code Here

  // Indicates whether we timed out waiting for the invocation to run
  @RunsInEDT
  private boolean postInvocationEvent(@Nonnull EventQueue eventQueue, long timeout) {
    Object lock = new RobotIdleLock();
    synchronized (lock) {
      eventQueue.postEvent(new InvocationEvent(toolkit, EMPTY_RUNNABLE, lock, true));
      long start = currentTimeMillis();
      try {
        // NOTE: on fast linux systems when showing a dialog, if we don't provide a timeout, we're never notified, and
        // the test will wait forever (up through 1.5.0_05).
        lock.wait(timeout);
View Full Code Here

        final JDesktopPane desktop = toolkit.getAwtContext().getDesktop();
        AppContext ac = SunToolkit.targetToAppContext(desktop);
        if (ac != null) {
            EventQueue eq = (EventQueue) ac.get(AppContext.EVENT_QUEUE_KEY);
            if (eq != null) {
                eq.postEvent(new InvocationEvent(Toolkit.getDefaultToolkit(), run));
                return;
            }
        }
        //shouldn't get here
        throw new RuntimeException("Desktop event queue not found!");
View Full Code Here

                class AWTInvocationLock {
                }
                Object lock = new AWTInvocationLock();

                InvocationEvent event = new InvocationEvent(Toolkit.getDefaultToolkit(), run, lock, true);

                try {
                    synchronized (lock) {
                        eq.postEvent(event);
                        lock.wait();
                    }
                } catch (Exception x) {
                    throw new RuntimeException(x);
                }

                Throwable eventThrowable = event.getThrowable();
                if (eventThrowable != null) {
                    throw new RuntimeException(eventThrowable);
                }

                 // --invoke and wait
View Full Code Here

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

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

        setValueIsAdjusting(stateController.isSliderDragged());
    }

    private void postAdjustmentEvent(final int type) {
        // create and post invocation event here:
        comp.postEvent(new InvocationEvent(ScrollPaneAdjustable.this, new Runnable() {
            public void run() {
                AdjustmentEvent event = new AdjustmentEvent(ScrollPaneAdjustable.this,
                        AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED, type, value,
                        getValueIsAdjusting());
                if (callAWTListener) {
View Full Code Here

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

  // Indicates whether we timed out waiting for the invocation to run
  @RunsInEDT
  private boolean postInvocationEvent(EventQueue eventQueue, long timeout) {
    Object lock = new RobotIdleLock();
    synchronized (lock) {
      eventQueue.postEvent(new InvocationEvent(toolkit, EMPTY_RUNNABLE, lock, true));
      long start = currentTimeMillis();
      try {
        // NOTE: on fast linux systems when showing a dialog, if we don't provide a timeout, we're never notified, and
        // the test will wait forever (up through 1.5.0_05).
        lock.wait(timeout);
View Full Code Here

TOP

Related Classes of java.awt.event.InvocationEvent

Copyright © 2018 www.massapicom. 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.