... until the collector arrives ...

This "blog" is really just a scratchpad of mine. There is not much of general interest here. Most of the content is scribbled down "live" as I discover things I want to remember. I rarely go back to correct mistakes in older entries. You have been warned :)


Pending Events in AWT and SWT

AWT does not provide a function to process pending UI events.  However, you can get the same effect by calling EventQueue.invokeLater(Runnable) which will not return until after all pending events are processed and the supplied Runnable finishes.  SwingUtilities also provides invokeLater.

SWT provides Display.readAndDispatch() to process all pending events.  This is a good thing, because trying the "invoke later" trick using Display.syncExec(Runnable) won't work.  SWT makes no guarantees about event processing in syncExec -- it simply ensures that the Runnable will be executed in the UI thread at "the next reasonable time".

Blog Archive