Java 类sun.awt.EventQueueItem 实例源码

项目:jdk-1.7-annotated    文件:EventQueue.java   
private boolean coalescePaintEvent(PaintEvent e) {
    ComponentPeer sourcePeer = ((Component)e.getSource()).peer;
    if (sourcePeer != null) {
        sourcePeer.coalescePaintEvent(e);
    }
    EventQueueItem[] cache = ((Component)e.getSource()).eventCache;
    if (cache == null) {
        return false;
    }
    int index = eventToCacheIndex(e);

    if (index != -1 && cache[index] != null) {
        PaintEvent merged = mergePaintEvents(e, (PaintEvent)cache[index].event);
        if (merged != null) {
            cache[index].event = merged;
            return true;
        }
    }
    return false;
}
项目:jdk-1.7-annotated    文件:EventQueue.java   
private boolean coalesceMouseEvent(MouseEvent e) {
    if (e instanceof SunDropTargetEvent) {
        // SunDropTargetEvent should not coalesce with MouseEvent
        return false;
    }
    EventQueueItem[] cache = ((Component)e.getSource()).eventCache;
    if (cache == null) {
        return false;
    }
    int index = eventToCacheIndex(e);
    if (index != -1 && cache[index] != null) {
        cache[index].event = e;
        return true;
    }
    return false;
}
项目:jdk-1.7-annotated    文件:EventQueue.java   
private boolean coalescePeerEvent(PeerEvent e) {
    EventQueueItem[] cache = ((Component)e.getSource()).eventCache;
    if (cache == null) {
        return false;
    }
    int index = eventToCacheIndex(e);
    if (index != -1 && cache[index] != null) {
        e = e.coalesceEvents((PeerEvent)cache[index].event);
        if (e != null) {
            cache[index].event = e;
            return true;
        } else {
            cache[index] = null;
        }
    }
    return false;
}
项目:jdk-1.7-annotated    文件:EventQueue.java   
private boolean coalesceOtherEvent(AWTEvent e, int priority) {
    int id = e.getID();
    Component source = (Component)e.getSource();
    for (EventQueueItem entry = queues[priority].head;
        entry != null; entry = entry.next)
    {
        // Give Component.coalesceEvents a chance
        if (entry.event.getSource() == source && entry.event.getID() == id) {
            AWTEvent coalescedEvent = source.coalesceEvents(
                entry.event, e);
            if (coalescedEvent != null) {
                entry.event = coalescedEvent;
                return true;
            }
        }
    }
    return false;
}
项目:jdk-1.7-annotated    文件:EventQueue.java   
/**
 * Returns the first event with the specified id, if any.
 * @param id the id of the type of event desired
 * @return the first event of the specified id or <code>null</code>
 *    if there is no such event
 */
public AWTEvent peekEvent(int id) {
    pushPopLock.lock();
    try {
        for (int i = NUM_PRIORITIES - 1; i >= 0; i--) {
            EventQueueItem q = queues[i].head;
            for (; q != null; q = q.next) {
                if (q.event.getID() == id) {
                    return q.event;
                }
            }
        }
    } finally {
        pushPopLock.unlock();
    }

    return null;
}
项目:jdk7-jdk    文件:EventQueue.java   
private boolean coalescePaintEvent(PaintEvent e) {
    ComponentPeer sourcePeer = ((Component)e.getSource()).peer;
    if (sourcePeer != null) {
        sourcePeer.coalescePaintEvent(e);
    }
    EventQueueItem[] cache = ((Component)e.getSource()).eventCache;
    if (cache == null) {
        return false;
    }
    int index = eventToCacheIndex(e);

    if (index != -1 && cache[index] != null) {
        PaintEvent merged = mergePaintEvents(e, (PaintEvent)cache[index].event);
        if (merged != null) {
            cache[index].event = merged;
            return true;
        }
    }
    return false;
}
项目:jdk7-jdk    文件:EventQueue.java   
private boolean coalescePeerEvent(PeerEvent e) {
    EventQueueItem[] cache = ((Component)e.getSource()).eventCache;
    if (cache == null) {
        return false;
    }
    int index = eventToCacheIndex(e);
    if (index != -1 && cache[index] != null) {
        e = e.coalesceEvents((PeerEvent)cache[index].event);
        if (e != null) {
            cache[index].event = e;
            return true;
        } else {
            cache[index] = null;
        }
    }
    return false;
}
项目:jdk7-jdk    文件:EventQueue.java   
private boolean coalesceOtherEvent(AWTEvent e, int priority) {
    int id = e.getID();
    Component source = (Component)e.getSource();
    for (EventQueueItem entry = queues[priority].head;
        entry != null; entry = entry.next)
    {
        // Give Component.coalesceEvents a chance
        if (entry.event.getSource() == source && entry.event.getID() == id) {
            AWTEvent coalescedEvent = source.coalesceEvents(
                entry.event, e);
            if (coalescedEvent != null) {
                entry.event = coalescedEvent;
                return true;
            }
        }
    }
    return false;
}
项目:jdk7-jdk    文件:EventQueue.java   
/**
 * Returns the first event with the specified id, if any.
 * @param id the id of the type of event desired
 * @return the first event of the specified id or <code>null</code>
 *    if there is no such event
 */
public AWTEvent peekEvent(int id) {
    pushPopLock.lock();
    try {
        for (int i = NUM_PRIORITIES - 1; i >= 0; i--) {
            EventQueueItem q = queues[i].head;
            for (; q != null; q = q.next) {
                if (q.event.getID() == id) {
                    return q.event;
                }
            }
        }
    } finally {
        pushPopLock.unlock();
    }

    return null;
}
项目:openjdk-source-code-learn    文件:EventQueue.java   
private boolean coalescePaintEvent(PaintEvent e) {
    ComponentPeer sourcePeer = ((Component)e.getSource()).peer;
    if (sourcePeer != null) {
        sourcePeer.coalescePaintEvent(e);
    }
    EventQueueItem[] cache = ((Component)e.getSource()).eventCache;
    if (cache == null) {
        return false;
    }
    int index = eventToCacheIndex(e);

    if (index != -1 && cache[index] != null) {
        PaintEvent merged = mergePaintEvents(e, (PaintEvent)cache[index].event);
        if (merged != null) {
            cache[index].event = merged;
            return true;
        }
    }
    return false;
}
项目:openjdk-source-code-learn    文件:EventQueue.java   
private boolean coalescePeerEvent(PeerEvent e) {
    EventQueueItem[] cache = ((Component)e.getSource()).eventCache;
    if (cache == null) {
        return false;
    }
    int index = eventToCacheIndex(e);
    if (index != -1 && cache[index] != null) {
        e = e.coalesceEvents((PeerEvent)cache[index].event);
        if (e != null) {
            cache[index].event = e;
            return true;
        } else {
            cache[index] = null;
        }
    }
    return false;
}
项目:openjdk-source-code-learn    文件:EventQueue.java   
private boolean coalesceOtherEvent(AWTEvent e, int priority) {
    int id = e.getID();
    Component source = (Component)e.getSource();
    for (EventQueueItem entry = queues[priority].head;
        entry != null; entry = entry.next)
    {
        // Give Component.coalesceEvents a chance
        if (entry.event.getSource() == source && entry.event.getID() == id) {
            AWTEvent coalescedEvent = source.coalesceEvents(
                entry.event, e);
            if (coalescedEvent != null) {
                entry.event = coalescedEvent;
                return true;
            }
        }
    }
    return false;
}
项目:openjdk-source-code-learn    文件:EventQueue.java   
/**
 * Returns the first event with the specified id, if any.
 * @param id the id of the type of event desired
 * @return the first event of the specified id or <code>null</code>
 *    if there is no such event
 */
public AWTEvent peekEvent(int id) {
    pushPopLock.lock();
    try {
        for (int i = NUM_PRIORITIES - 1; i >= 0; i--) {
            EventQueueItem q = queues[i].head;
            for (; q != null; q = q.next) {
                if (q.event.getID() == id) {
                    return q.event;
                }
            }
        }
    } finally {
        pushPopLock.unlock();
    }

    return null;
}
项目:openjdk-jdk7u-jdk    文件:EventQueue.java   
private boolean coalescePaintEvent(PaintEvent e) {
    ComponentPeer sourcePeer = ((Component)e.getSource()).peer;
    if (sourcePeer != null) {
        sourcePeer.coalescePaintEvent(e);
    }
    EventQueueItem[] cache = ((Component)e.getSource()).eventCache;
    if (cache == null) {
        return false;
    }
    int index = eventToCacheIndex(e);

    if (index != -1 && cache[index] != null) {
        PaintEvent merged = mergePaintEvents(e, (PaintEvent)cache[index].event);
        if (merged != null) {
            cache[index].event = merged;
            return true;
        }
    }
    return false;
}
项目:openjdk-jdk7u-jdk    文件:EventQueue.java   
private boolean coalesceMouseEvent(MouseEvent e) {
    if (e instanceof SunDropTargetEvent) {
        // SunDropTargetEvent should not coalesce with MouseEvent
        return false;
    }
    EventQueueItem[] cache = ((Component)e.getSource()).eventCache;
    if (cache == null) {
        return false;
    }
    int index = eventToCacheIndex(e);
    if (index != -1 && cache[index] != null) {
        cache[index].event = e;
        return true;
    }
    return false;
}
项目:openjdk-jdk7u-jdk    文件:EventQueue.java   
private boolean coalescePeerEvent(PeerEvent e) {
    EventQueueItem[] cache = ((Component)e.getSource()).eventCache;
    if (cache == null) {
        return false;
    }
    int index = eventToCacheIndex(e);
    if (index != -1 && cache[index] != null) {
        e = e.coalesceEvents((PeerEvent)cache[index].event);
        if (e != null) {
            cache[index].event = e;
            return true;
        } else {
            cache[index] = null;
        }
    }
    return false;
}
项目:openjdk-jdk7u-jdk    文件:EventQueue.java   
private boolean coalesceOtherEvent(AWTEvent e, int priority) {
    int id = e.getID();
    Component source = (Component)e.getSource();
    for (EventQueueItem entry = queues[priority].head;
        entry != null; entry = entry.next)
    {
        // Give Component.coalesceEvents a chance
        if (entry.event.getSource() == source && entry.event.getID() == id) {
            AWTEvent coalescedEvent = source.coalesceEvents(
                entry.event, e);
            if (coalescedEvent != null) {
                entry.event = coalescedEvent;
                return true;
            }
        }
    }
    return false;
}
项目:openjdk-jdk7u-jdk    文件:EventQueue.java   
/**
 * Returns the first event with the specified id, if any.
 * @param id the id of the type of event desired
 * @return the first event of the specified id or <code>null</code>
 *    if there is no such event
 */
public AWTEvent peekEvent(int id) {
    pushPopLock.lock();
    try {
        for (int i = NUM_PRIORITIES - 1; i >= 0; i--) {
            EventQueueItem q = queues[i].head;
            for (; q != null; q = q.next) {
                if (q.event.getID() == id) {
                    return q.event;
                }
            }
        }
    } finally {
        pushPopLock.unlock();
    }

    return null;
}
项目:openjdk-icedtea7    文件:EventQueue.java   
private boolean coalescePaintEvent(PaintEvent e) {
    ComponentPeer sourcePeer = ((Component)e.getSource()).peer;
    if (sourcePeer != null) {
        sourcePeer.coalescePaintEvent(e);
    }
    EventQueueItem[] cache = ((Component)e.getSource()).eventCache;
    if (cache == null) {
        return false;
    }
    int index = eventToCacheIndex(e);

    if (index != -1 && cache[index] != null) {
        PaintEvent merged = mergePaintEvents(e, (PaintEvent)cache[index].event);
        if (merged != null) {
            cache[index].event = merged;
            return true;
        }
    }
    return false;
}
项目:openjdk-icedtea7    文件:EventQueue.java   
private boolean coalesceMouseEvent(MouseEvent e) {
    if (e instanceof SunDropTargetEvent) {
        // SunDropTargetEvent should not coalesce with MouseEvent
        return false;
    }
    EventQueueItem[] cache = ((Component)e.getSource()).eventCache;
    if (cache == null) {
        return false;
    }
    int index = eventToCacheIndex(e);
    if (index != -1 && cache[index] != null) {
        cache[index].event = e;
        return true;
    }
    return false;
}
项目:openjdk-icedtea7    文件:EventQueue.java   
private boolean coalescePeerEvent(PeerEvent e) {
    EventQueueItem[] cache = ((Component)e.getSource()).eventCache;
    if (cache == null) {
        return false;
    }
    int index = eventToCacheIndex(e);
    if (index != -1 && cache[index] != null) {
        e = e.coalesceEvents((PeerEvent)cache[index].event);
        if (e != null) {
            cache[index].event = e;
            return true;
        } else {
            cache[index] = null;
        }
    }
    return false;
}
项目:openjdk-icedtea7    文件:EventQueue.java   
private boolean coalesceOtherEvent(AWTEvent e, int priority) {
    int id = e.getID();
    Component source = (Component)e.getSource();
    for (EventQueueItem entry = queues[priority].head;
        entry != null; entry = entry.next)
    {
        // Give Component.coalesceEvents a chance
        if (entry.event.getSource() == source && entry.event.getID() == id) {
            AWTEvent coalescedEvent = source.coalesceEvents(
                entry.event, e);
            if (coalescedEvent != null) {
                entry.event = coalescedEvent;
                return true;
            }
        }
    }
    return false;
}
项目:openjdk-icedtea7    文件:EventQueue.java   
/**
 * Returns the first event with the specified id, if any.
 * @param id the id of the type of event desired
 * @return the first event of the specified id or <code>null</code>
 *    if there is no such event
 */
public AWTEvent peekEvent(int id) {
    pushPopLock.lock();
    try {
        for (int i = NUM_PRIORITIES - 1; i >= 0; i--) {
            EventQueueItem q = queues[i].head;
            for (; q != null; q = q.next) {
                if (q.event.getID() == id) {
                    return q.event;
                }
            }
        }
    } finally {
        pushPopLock.unlock();
    }

    return null;
}
项目:jdk-1.7-annotated    文件:EventQueue.java   
/**
 * Posts the event to the internal Queue of specified priority,
 * coalescing as appropriate.
 *
 * @param theEvent an instance of <code>java.awt.AWTEvent</code>,
 *          or a subclass of it
 * @param priority  the desired priority of the event
 */
private void postEvent(AWTEvent theEvent, int priority) {
    if (coalesceEvent(theEvent, priority)) {
        return;
    }

    EventQueueItem newItem = new EventQueueItem(theEvent);

    cacheEQItem(newItem);

    boolean notifyID = (theEvent.getID() == this.waitForID);

    if (queues[priority].head == null) {
        boolean shouldNotify = noEvents();
        queues[priority].head = queues[priority].tail = newItem;

        if (shouldNotify) {
            if (theEvent.getSource() != AWTAutoShutdown.getInstance()) {
                AWTAutoShutdown.getInstance().notifyThreadBusy(dispatchThread);
            }
            pushPopCond.signalAll();
        } else if (notifyID) {
            pushPopCond.signalAll();
        }
    } else {
        // The event was not coalesced or has non-Component source.
        // Insert it at the end of the appropriate Queue.
        queues[priority].tail.next = newItem;
        queues[priority].tail = newItem;
        if (notifyID) {
            pushPopCond.signalAll();
        }
    }
}
项目:jdk-1.7-annotated    文件:EventQueue.java   
private void cacheEQItem(EventQueueItem entry) {
    if(entry.event instanceof SunDropTargetEvent) {
        // Do not cache SunDropTargetEvent, it should not coalesce
        return;
    }
    int index = eventToCacheIndex(entry.event);
    if (index != -1 && entry.event.getSource() instanceof Component) {
        Component source = (Component)entry.event.getSource();
        if (source.eventCache == null) {
            source.eventCache = new EventQueueItem[CACHE_LENGTH];
        }
        source.eventCache[index] = entry;
    }
}
项目:jdk-1.7-annotated    文件:EventQueue.java   
private void uncacheEQItem(EventQueueItem entry) {
    int index = eventToCacheIndex(entry.event);
    if (index != -1 && entry.event.getSource() instanceof Component) {
        Component source = (Component)entry.event.getSource();
        if (source.eventCache == null) {
            return;
        }
        source.eventCache[index] = null;
    }
}
项目:jdk-1.7-annotated    文件:EventQueue.java   
AWTEvent getNextEventPrivate() throws InterruptedException {
    for (int i = NUM_PRIORITIES - 1; i >= 0; i--) {
        if (queues[i].head != null) {
            EventQueueItem entry = queues[i].head;
            queues[i].head = entry.next;
            if (entry.next == null) {
                queues[i].tail = null;
            }
            uncacheEQItem(entry);
            return entry.event;
        }
    }
    return null;
}
项目:jdk-1.7-annotated    文件:EventQueue.java   
AWTEvent getNextEvent(int id) throws InterruptedException {
    do {
        /*
         * SunToolkit.flushPendingEvents must be called outside
         * of the synchronized block to avoid deadlock when
         * event queues are nested with push()/pop().
         */
        SunToolkit.flushPendingEvents(appContext);
        pushPopLock.lock();
        try {
            for (int i = 0; i < NUM_PRIORITIES; i++) {
                for (EventQueueItem entry = queues[i].head, prev = null;
                     entry != null; prev = entry, entry = entry.next)
                {
                    if (entry.event.getID() == id) {
                        if (prev == null) {
                            queues[i].head = entry.next;
                        } else {
                            prev.next = entry.next;
                        }
                        if (queues[i].tail == entry) {
                            queues[i].tail = prev;
                        }
                        uncacheEQItem(entry);
                        return entry.event;
                    }
                }
            }
            waitForID = id;
            pushPopCond.await();
            waitForID = 0;
        } finally {
            pushPopLock.unlock();
        }
    } while(true);
}
项目:jdk7-jdk    文件:EventQueue.java   
/**
 * Posts the event to the internal Queue of specified priority,
 * coalescing as appropriate.
 *
 * @param theEvent an instance of <code>java.awt.AWTEvent</code>,
 *          or a subclass of it
 * @param priority  the desired priority of the event
 */
private void postEvent(AWTEvent theEvent, int priority) {
    if (coalesceEvent(theEvent, priority)) {
        return;
    }

    EventQueueItem newItem = new EventQueueItem(theEvent);

    cacheEQItem(newItem);

    boolean notifyID = (theEvent.getID() == this.waitForID);

    if (queues[priority].head == null) {
        boolean shouldNotify = noEvents();
        queues[priority].head = queues[priority].tail = newItem;

        if (shouldNotify) {
            if (theEvent.getSource() != AWTAutoShutdown.getInstance()) {
                AWTAutoShutdown.getInstance().notifyThreadBusy(dispatchThread);
            }
            pushPopCond.signalAll();
        } else if (notifyID) {
            pushPopCond.signalAll();
        }
    } else {
        // The event was not coalesced or has non-Component source.
        // Insert it at the end of the appropriate Queue.
        queues[priority].tail.next = newItem;
        queues[priority].tail = newItem;
        if (notifyID) {
            pushPopCond.signalAll();
        }
    }
}
项目:jdk7-jdk    文件:EventQueue.java   
private boolean coalesceMouseEvent(MouseEvent e) {
    EventQueueItem[] cache = ((Component)e.getSource()).eventCache;
    if (cache == null) {
        return false;
    }
    int index = eventToCacheIndex(e);
    if (index != -1 && cache[index] != null) {
        cache[index].event = e;
        return true;
    }
    return false;
}
项目:jdk7-jdk    文件:EventQueue.java   
private void cacheEQItem(EventQueueItem entry) {
    int index = eventToCacheIndex(entry.event);
    if (index != -1 && entry.event.getSource() instanceof Component) {
        Component source = (Component)entry.event.getSource();
        if (source.eventCache == null) {
            source.eventCache = new EventQueueItem[CACHE_LENGTH];
        }
        source.eventCache[index] = entry;
    }
}
项目:jdk7-jdk    文件:EventQueue.java   
private void uncacheEQItem(EventQueueItem entry) {
    int index = eventToCacheIndex(entry.event);
    if (index != -1 && entry.event.getSource() instanceof Component) {
        Component source = (Component)entry.event.getSource();
        if (source.eventCache == null) {
            return;
        }
        source.eventCache[index] = null;
    }
}
项目:jdk7-jdk    文件:EventQueue.java   
AWTEvent getNextEventPrivate() throws InterruptedException {
    for (int i = NUM_PRIORITIES - 1; i >= 0; i--) {
        if (queues[i].head != null) {
            EventQueueItem entry = queues[i].head;
            queues[i].head = entry.next;
            if (entry.next == null) {
                queues[i].tail = null;
            }
            uncacheEQItem(entry);
            return entry.event;
        }
    }
    return null;
}
项目:jdk7-jdk    文件:EventQueue.java   
AWTEvent getNextEvent(int id) throws InterruptedException {
    do {
        /*
         * SunToolkit.flushPendingEvents must be called outside
         * of the synchronized block to avoid deadlock when
         * event queues are nested with push()/pop().
         */
        SunToolkit.flushPendingEvents();
        pushPopLock.lock();
        try {
            for (int i = 0; i < NUM_PRIORITIES; i++) {
                for (EventQueueItem entry = queues[i].head, prev = null;
                     entry != null; prev = entry, entry = entry.next)
                {
                    if (entry.event.getID() == id) {
                        if (prev == null) {
                            queues[i].head = entry.next;
                        } else {
                            prev.next = entry.next;
                        }
                        if (queues[i].tail == entry) {
                            queues[i].tail = prev;
                        }
                        uncacheEQItem(entry);
                        return entry.event;
                    }
                }
            }
            waitForID = id;
            pushPopCond.await();
            waitForID = 0;
        } finally {
            pushPopLock.unlock();
        }
    } while(true);
}
项目:jdk7-jdk    文件:EventQueue.java   
final void removeSourceEvents(Object source, boolean removeAllEvents) {
    SunToolkit.flushPendingEvents();
    pushPopLock.lock();
    try {
        for (int i = 0; i < NUM_PRIORITIES; i++) {
            EventQueueItem entry = queues[i].head;
            EventQueueItem prev = null;
            while (entry != null) {
                if ((entry.event.getSource() == source)
                    && (removeAllEvents
                        || ! (entry.event instanceof SequencedEvent
                              || entry.event instanceof SentEvent
                              || entry.event instanceof FocusEvent
                              || entry.event instanceof WindowEvent
                              || entry.event instanceof KeyEvent
                              || entry.event instanceof InputMethodEvent)))
                {
                    if (entry.event instanceof SequencedEvent) {
                        ((SequencedEvent)entry.event).dispose();
                    }
                    if (entry.event instanceof SentEvent) {
                        ((SentEvent)entry.event).dispose();
                    }
                    if (prev == null) {
                        queues[i].head = entry.next;
                    } else {
                        prev.next = entry.next;
                    }
                    uncacheEQItem(entry);
                } else {
                    prev = entry;
                }
                entry = entry.next;
            }
            queues[i].tail = prev;
        }
    } finally {
        pushPopLock.unlock();
    }
}
项目:openjdk-source-code-learn    文件:EventQueue.java   
/**
 * Posts the event to the internal Queue of specified priority,
 * coalescing as appropriate.
 *
 * @param theEvent an instance of <code>java.awt.AWTEvent</code>,
 *          or a subclass of it
 * @param priority  the desired priority of the event
 */
private void postEvent(AWTEvent theEvent, int priority) {
    if (coalesceEvent(theEvent, priority)) {
        return;
    }

    EventQueueItem newItem = new EventQueueItem(theEvent);

    cacheEQItem(newItem);

    boolean notifyID = (theEvent.getID() == this.waitForID);

    if (queues[priority].head == null) {
        boolean shouldNotify = noEvents();
        queues[priority].head = queues[priority].tail = newItem;

        if (shouldNotify) {
            if (theEvent.getSource() != AWTAutoShutdown.getInstance()) {
                AWTAutoShutdown.getInstance().notifyThreadBusy(dispatchThread);
            }
            pushPopCond.signalAll();
        } else if (notifyID) {
            pushPopCond.signalAll();
        }
    } else {
        // The event was not coalesced or has non-Component source.
        // Insert it at the end of the appropriate Queue.
        queues[priority].tail.next = newItem;
        queues[priority].tail = newItem;
        if (notifyID) {
            pushPopCond.signalAll();
        }
    }
}
项目:openjdk-source-code-learn    文件:EventQueue.java   
private boolean coalesceMouseEvent(MouseEvent e) {
    EventQueueItem[] cache = ((Component)e.getSource()).eventCache;
    if (cache == null) {
        return false;
    }
    int index = eventToCacheIndex(e);
    if (index != -1 && cache[index] != null) {
        cache[index].event = e;
        return true;
    }
    return false;
}
项目:openjdk-source-code-learn    文件:EventQueue.java   
private void cacheEQItem(EventQueueItem entry) {
    int index = eventToCacheIndex(entry.event);
    if (index != -1 && entry.event.getSource() instanceof Component) {
        Component source = (Component)entry.event.getSource();
        if (source.eventCache == null) {
            source.eventCache = new EventQueueItem[CACHE_LENGTH];
        }
        source.eventCache[index] = entry;
    }
}
项目:openjdk-source-code-learn    文件:EventQueue.java   
private void uncacheEQItem(EventQueueItem entry) {
    int index = eventToCacheIndex(entry.event);
    if (index != -1 && entry.event.getSource() instanceof Component) {
        Component source = (Component)entry.event.getSource();
        if (source.eventCache == null) {
            return;
        }
        source.eventCache[index] = null;
    }
}
项目:openjdk-source-code-learn    文件:EventQueue.java   
AWTEvent getNextEventPrivate() throws InterruptedException {
    for (int i = NUM_PRIORITIES - 1; i >= 0; i--) {
        if (queues[i].head != null) {
            EventQueueItem entry = queues[i].head;
            queues[i].head = entry.next;
            if (entry.next == null) {
                queues[i].tail = null;
            }
            uncacheEQItem(entry);
            return entry.event;
        }
    }
    return null;
}