Java tutorial
//package com.java2s; import java.awt.*; public class Main { /** * Posts the specified runnable to the event queue and returns. The * runnable will run in the event queue when its turn is reached. * * @param runnable the runnable to run in the event queue */ public synchronized static void runLaterInEventThread(Runnable runnable) { EventQueue.invokeLater(runnable); } }