Package java.awt

Examples of java.awt.EventQueue


  private synchronized void startModal() {

        try {
            if (SwingUtilities.isEventDispatchThread()) {
                EventQueue theQueue = getToolkit().getSystemEventQueue();
                while (!selected) {
                    AWTEvent event = theQueue.getNextEvent();
                    Object source = event.getSource();
                    boolean dispatch = true;

                    if (event instanceof MouseEvent) {
                        MouseEvent e = (MouseEvent) event;
View Full Code Here


        // If the eventQueue can't be retrieved, the thread gets interrupted,
        // or the thread isn't a instanceof EventDispatchThread then return
        // a null as we won't be able to trap events.
        try {
            if (EventQueue.isDispatchThread()) {
                EventQueue eq = null;
               
                // Find the eventQueue. If we can't get to it then just return
                // null since we won't be able to trap any events.
               
                try {
                    eq = Toolkit.getDefaultToolkit().getSystemEventQueue();
                } catch (Exception ee) {
                    debug(ee);
                }
               
                // Safe guard
                if (eq == null) {
                    return null;
                }
               
                int eventNumber = -1;
               
                // Process the events until an object has been selected or
                // the context-sensitive search has been canceled.
                while (true) {
                    // This is essentially the body of EventDispatchThread
                    // modified to trap context-senstive events and act
                    // appropriately
                    eventNumber++;
                    AWTEvent event = eq.getNextEvent();
                    Object src = event.getSource();
                    // can't call eq.dispatchEvent
                    // so I pasted it's body here
                   
                    // debug(event);
View Full Code Here

    /**
     * Processes the next GUI event.
     */
    public void dispatchNextGuiEvent() throws InterruptedException {
        EventQueue queue = awtEventQueue;
        if (queue == null) {
            queue = Toolkit.getDefaultToolkit().getSystemEventQueue();
            awtEventQueue = queue;
        }
        AWTEvent event = queue.getNextEvent();
        if (event instanceof ActiveEvent) {
            ((ActiveEvent)event).dispatch();
        } else {
            Object source = event.getSource();
            if (source instanceof Component) {
View Full Code Here

    /**
     * Processes the next GUI event.
     */
    public void dispatchNextGuiEvent() throws InterruptedException {
        EventQueue queue = awtEventQueue;
        if (queue == null) {
            queue = Toolkit.getDefaultToolkit().getSystemEventQueue();
            awtEventQueue = queue;
        }
        AWTEvent event = queue.getNextEvent();
        if (event instanceof ActiveEvent) {
            ((ActiveEvent)event).dispatch();
        } else {
            Object source = event.getSource();
            if (source instanceof Component) {
View Full Code Here

        public PostShutdownEventRunnable(AppContext ac) {
            appContext = ac;
        }

        public void run() {
            final EventQueue eq = (EventQueue)appContext.get(EVENT_QUEUE_KEY);
            if (eq != null) {
                eq.postEvent(AWTAutoShutdown.getShutdownEvent());
            }
        }
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));
    }
View Full Code Here

    }

    private void click(int modifiers) {
        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();
    }
View Full Code Here

    private void type(int keyCode, int modifiers) {
        KeyEvent event = new KeyEvent(dialog, KeyEvent.KEY_PRESSED, System.currentTimeMillis(), modifiers, keyCode, (char) 0);
        Point p = dialog.getButton().getLocationOnScreen();
        SwingUtilities.convertPointFromScreen(p, dialog);
        EventQueue systemEventQueue = Toolkit.getDefaultToolkit().getSystemEventQueue();
        // systemEventQueue.postEvent(new MouseEvent(dialog,
        // MouseEvent.MOUSE_MOVED, System.currentTimeMillis(),
        // modifiers, p.x, p.y, 1, false));
        systemEventQueue.postEvent(event);
        AWTSync.sync();
    }
View Full Code Here

        public PostShutdownEventRunnable(AppContext ac) {
            appContext = ac;
        }

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

         * This is a BIG TIME HACK (that seems to work!) to work around the problem of
         * popupMenuCanceled() not being called.
         * @return boolean
         */
        private boolean isPopupCanceled() {
            EventQueue queue = Toolkit.getDefaultToolkit().getSystemEventQueue();
            AWTEvent event = queue.peekEvent();
           
            if (event == null) {
                return true;
            } else {
                if (event instanceof InvocationEvent) {
View Full Code Here

TOP

Related Classes of java.awt.EventQueue

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.