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

Print this page




 200                     eventQueue.removeSourceEvents(source, removeAllEvents);
 201                 }
 202                 public boolean noEvents(EventQueue eventQueue) {
 203                     return eventQueue.noEvents();
 204                 }
 205                 public void wakeup(EventQueue eventQueue, boolean isShutdown) {
 206                     eventQueue.wakeup(isShutdown);
 207                 }
 208                 public void invokeAndWait(Object source, Runnable r)
 209                     throws InterruptedException, InvocationTargetException
 210                 {
 211                     EventQueue.invokeAndWait(source, r);
 212                 }
 213                 public void setFwDispatcher(EventQueue eventQueue,
 214                                             FwDispatcher dispatcher) {
 215                     eventQueue.setFwDispatcher(dispatcher);
 216                 }
 217             });
 218     }
 219 



 220     public EventQueue() {
 221         for (int i = 0; i < NUM_PRIORITIES; i++) {
 222             queues[i] = new Queue();
 223         }
 224         /*
 225          * NOTE: if you ever have to start the associated event dispatch
 226          * thread at this point, be aware of the following problem:
 227          * If this EventQueue instance is created in
 228          * SunToolkit.createNewAppContext() the started dispatch thread
 229          * may call AppContext.getAppContext() before createNewAppContext()
 230          * completes thus causing mess in thread group to appcontext mapping.
 231          */
 232 
 233         appContext = AppContext.getAppContext();
 234         pushPopLock = (Lock)appContext.get(AppContext.EVENT_QUEUE_LOCK_KEY);
 235         pushPopCond = (Condition)appContext.get(AppContext.EVENT_QUEUE_COND_KEY);
 236     }
 237 
 238     /**
 239      * Posts a 1.1-style event to the <code>EventQueue</code>.




 200                     eventQueue.removeSourceEvents(source, removeAllEvents);
 201                 }
 202                 public boolean noEvents(EventQueue eventQueue) {
 203                     return eventQueue.noEvents();
 204                 }
 205                 public void wakeup(EventQueue eventQueue, boolean isShutdown) {
 206                     eventQueue.wakeup(isShutdown);
 207                 }
 208                 public void invokeAndWait(Object source, Runnable r)
 209                     throws InterruptedException, InvocationTargetException
 210                 {
 211                     EventQueue.invokeAndWait(source, r);
 212                 }
 213                 public void setFwDispatcher(EventQueue eventQueue,
 214                                             FwDispatcher dispatcher) {
 215                     eventQueue.setFwDispatcher(dispatcher);
 216                 }
 217             });
 218     }
 219 
 220     /**
 221      * Initializes a new instance of {@code EventQueue}.
 222      */
 223     public EventQueue() {
 224         for (int i = 0; i < NUM_PRIORITIES; i++) {
 225             queues[i] = new Queue();
 226         }
 227         /*
 228          * NOTE: if you ever have to start the associated event dispatch
 229          * thread at this point, be aware of the following problem:
 230          * If this EventQueue instance is created in
 231          * SunToolkit.createNewAppContext() the started dispatch thread
 232          * may call AppContext.getAppContext() before createNewAppContext()
 233          * completes thus causing mess in thread group to appcontext mapping.
 234          */
 235 
 236         appContext = AppContext.getAppContext();
 237         pushPopLock = (Lock)appContext.get(AppContext.EVENT_QUEUE_LOCK_KEY);
 238         pushPopCond = (Condition)appContext.get(AppContext.EVENT_QUEUE_COND_KEY);
 239     }
 240 
 241     /**
 242      * Posts a 1.1-style event to the <code>EventQueue</code>.