< prev index next >

src/java.desktop/share/classes/java/awt/EventQueue.java

Print this page




 266      * {@code coalesceEvents} method will be called.
 267      *
 268      * @param theEvent an instance of {@code java.awt.AWTEvent},
 269      *          or a subclass of it
 270      * @throws NullPointerException if {@code theEvent} is {@code null}
 271      */
 272     public void postEvent(AWTEvent theEvent) {
 273         SunToolkit.flushPendingEvents(appContext);
 274         postEventPrivate(theEvent);
 275     }
 276 
 277     /**
 278      * Posts a 1.1-style event to the {@code EventQueue}.
 279      * If there is an existing event on the queue with the same ID
 280      * and event source, the source {@code Component}'s
 281      * {@code coalesceEvents} method will be called.
 282      *
 283      * @param theEvent an instance of {@code java.awt.AWTEvent},
 284      *          or a subclass of it
 285      */
 286     private final void postEventPrivate(AWTEvent theEvent) {
 287         theEvent.isPosted = true;
 288         pushPopLock.lock();
 289         try {
 290             if (nextQueue != null) {
 291                 // Forward the event to the top of EventQueue stack
 292                 nextQueue.postEventPrivate(theEvent);
 293                 return;
 294             }
 295             if (dispatchThread == null) {
 296                 if (theEvent.getSource() == AWTAutoShutdown.getInstance()) {
 297                     return;
 298                 } else {
 299                     initDispatchThread();
 300                 }
 301             }
 302             postEvent(theEvent, getPriority(theEvent));
 303         } finally {
 304             pushPopLock.unlock();
 305         }
 306     }




 266      * {@code coalesceEvents} method will be called.
 267      *
 268      * @param theEvent an instance of {@code java.awt.AWTEvent},
 269      *          or a subclass of it
 270      * @throws NullPointerException if {@code theEvent} is {@code null}
 271      */
 272     public void postEvent(AWTEvent theEvent) {
 273         SunToolkit.flushPendingEvents(appContext);
 274         postEventPrivate(theEvent);
 275     }
 276 
 277     /**
 278      * Posts a 1.1-style event to the {@code EventQueue}.
 279      * If there is an existing event on the queue with the same ID
 280      * and event source, the source {@code Component}'s
 281      * {@code coalesceEvents} method will be called.
 282      *
 283      * @param theEvent an instance of {@code java.awt.AWTEvent},
 284      *          or a subclass of it
 285      */
 286     private void postEventPrivate(AWTEvent theEvent) {
 287         theEvent.isPosted = true;
 288         pushPopLock.lock();
 289         try {
 290             if (nextQueue != null) {
 291                 // Forward the event to the top of EventQueue stack
 292                 nextQueue.postEventPrivate(theEvent);
 293                 return;
 294             }
 295             if (dispatchThread == null) {
 296                 if (theEvent.getSource() == AWTAutoShutdown.getInstance()) {
 297                     return;
 298                 } else {
 299                     initDispatchThread();
 300                 }
 301             }
 302             postEvent(theEvent, getPriority(theEvent));
 303         } finally {
 304             pushPopLock.unlock();
 305         }
 306     }


< prev index next >