Added a method to run code at the end of the Swing thread (after all
other invokeLater runnables).