catch (InterruptedException ie) { } } }
  public synchronized AWTEvent getNextEvent()    throws InterruptedException  {        if (next != null)            return next.getNextEvent();        ClasspathToolkit tk = ((ClasspathToolkit) Toolkit.getDefaultToolkit());        long curr = System.currentTimeMillis();    if (! tk.nativeQueueEmpty() &&        (curr - lastNativeQueueAccess > humanLatencyThreshold))      {            tk.iterateNativeQueue(this, false);            lastNativeQueueAccess = curr;        }    while (next_in == next_out)      {        // Only the EventDispatchThread associated with the top of the stack is            // allowed to get events from the native source; everyone else just            // waits on the head of the queue.        if (isDispatchThread())          {                // We are not allowed to return null from this method, yet it                // is possible that we actually have run out of native events                // in the enclosing while() loop, and none of the native events                // happened to cause AWT events. We therefore ought to check                // the isShutdown() condition here, before risking a "native                // wait". If we check it before entering this function we may                // wait forever for events after the shutdown condition has                // arisen.                if (isShutdown())                    throw new InterruptedException();                tk.iterateNativeQueue(this, true);                lastNativeQueueAccess = System.currentTimeMillis();          }        else          {            try              {                    wait();              }            catch (InterruptedException ie)              {                }            }        }        AWTEvent res = queue[next_out];        if (++next_out == queue.length)            next_out = 0;        return res;    }