.getPreferredScrollableViewportSize());
}
private void waitUntilEventQueueIsEmpty() throws InterruptedException, InvocationTargetException {
// we have to sleep here until the asynchronously attachement of JLayeredPane and the overlay is finished
EventQueue eventQueue = Toolkit.getDefaultToolkit().getSystemEventQueue();
AWTEvent peekEvent;
while((peekEvent = eventQueue.peekEvent()) != null) {
System.out.println("got event in queue: " + peekEvent);
Thread.currentThread().sleep(0);
}
// Added 10/10/07 AlD: Sometimes the above loop fails to work!? This
// should further ensure the event loop is empty.