next_out = 0; next_in = oldQueue.length; } notify(); }
next_out = 0; next_in = oldQueue.length; }  if (dispatchThread == null || !dispatchThread.isAlive()) { System.out .println("Start new dispatchThread old=" + dispatchThread); dispatchThread = new EventDispatchThread(this); dispatchThread.start(); }      if (!isDispatchThread() || (evt.getID() == WindowEvent.WINDOW_CLOSED) || (evt.getID() == WindowEvent.WINDOW_CLOSING)) ((ClasspathToolkit) Toolkit.getDefaultToolkit()).wakeNativeQueue();  notify(); }
  public synchronized void postEvent(AWTEvent evt)  {    if (evt == null)      throw new NullPointerException();    if (next != null)      {			next.postEvent(evt);			return;		}		/* Check for any events already on the queue with the same source 		   and ID. */		int i = next_out;    while (i != next_in)      {			AWTEvent qevt = queue[i];			Object src;        if (qevt.id == evt.id            && (src = qevt.getSource()) == evt.getSource()            && src instanceof Component)          {				/* If there are, call coalesceEvents on the source component 				   to see if they can be combined. */				Component srccmp = (Component) src;				AWTEvent coalesced_evt = srccmp.coalesceEvents(qevt, evt);            if (coalesced_evt != null)              {					/* Yes. Replace the existing event with the combined event. */					queue[i] = coalesced_evt;					return;				}				break;			}			if (++i == queue.length)				i = 0;		}		queue[next_in] = evt;		if (++next_in == queue.length)			next_in = 0;    if (next_in == next_out)      {			/* Queue is full. Extend it. */			AWTEvent[] oldQueue = queue;			queue = new AWTEvent[queue.length * 2];			int len = oldQueue.length - next_out;			System.arraycopy(oldQueue, next_out, queue, 0, len);			if (next_out != 0)				System.arraycopy(oldQueue, 0, queue, len, next_out);			next_out = 0;			next_in = oldQueue.length;		}		notify();	}