Package java.awt

Examples of java.awt.EventQueue.postEvent()


    // Force an update of the input state, so that we're in synch internally. Otherwise we might post more events before
    // this one gets processed and end up using stale values for those events.
    inputState.update(event);
    EventQueue eventQueue = eventQueueFor(c);
    if (eventQueue != null) {
      eventQueue.postEvent(event);
    }
    pause(settings.delayBetweenEvents());
  }

  /* Usually only needed when dealing with Applets. */
 
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

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

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

        } else {
            EventQueue eq = (EventQueue) ac.get(AppContext.EVENT_QUEUE_KEY);
            if (eq == null) {
                target.dispatchEvent(SwingToolkit.convertEvent(event, target));
            } else {
                eq.postEvent(SwingToolkit.convertEvent(event, target));
            }
        }
    }

    /**
 
View Full Code Here

            if (queue == null) {
                queue = Toolkit.getDefaultToolkit().getSystemEventQueue();
            }
        }

        queue.postEvent(event);
    }

    @Override
    public Insets getScreenInsets(GraphicsConfiguration gc) throws HeadlessException {
        JNodeAwtContext awtc = getAwtContext();
View Full Code Here

    WindowEvent event = new WindowEvent(w, WINDOW_CLOSING);
    // If the window contains an applet, send the event on the applet's queue instead to ensure a shutdown from the
    // applet's context (assists AppletViewer cleanup).
    Component applet = findAppletDescendent(w);
    EventQueue eventQueue = windowMonitor.eventQueueFor(applet != null ? applet : w);
    eventQueue.postEvent(event);
    waitForIdle();
  }

  /**
   * Returns the <code>{@link Applet}</code> descendant of the given <code>{@link Container}</code>, if any.
View Full Code Here

    for (Component target : targets)
    {
      GUIEvent<Type> eventCopy = event.copy();
      eventCopy.setSource(target);
     
      eventQueue.postEvent(eventCopy);
    }   
  }

}
View Full Code Here

        }

        public void run() {
            final EventQueue eq = (EventQueue)appContext.get(EVENT_QUEUE_KEY);
            if (eq != null) {
                eq.postEvent(AWTAutoShutdown.getShutdownEvent());
            }
        }
    }

    static final class CreateThreadAction implements PrivilegedAction {
View Full Code Here

    public void play(ComponentFinder resolver) {
        logger.info("Trying to close the window...: isShowing = " + window.isShowing() + " isVisible: " + window.isVisible() + " isValid: " + window.isValid());
        if (!window.isShowing() || !window.isVisible())
            return;
        EventQueue eventQueue = window.getToolkit().getSystemEventQueue();
        eventQueue.postEvent(new WindowEvent(window, WindowEvent.WINDOW_CLOSING));
    }

    public IScriptElement enscript() {
        return new IScriptElement() {
            private static final long serialVersionUID = 1L;
View Full Code Here

        Point p = dialog.getButton().getLocationOnScreen();
        SwingUtilities.convertPointFromScreen(p, dialog);
        EventQueue systemEventQueue = Toolkit.getDefaultToolkit().getSystemEventQueue();
        MouseEvent theEvent = new MouseEvent(dialog, MouseEvent.MOUSE_PRESSED, System.currentTimeMillis(), modifiers, p.x, p.y, 1,
                false);
        systemEventQueue.postEvent(theEvent);
        AWTSync.sync();
    }

    private void type(int keyCode, int modifiers) {
        KeyEvent event = new KeyEvent(dialog, KeyEvent.KEY_PRESSED, System.currentTimeMillis(), modifiers, keyCode, (char) 0);
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.