import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; public class TimerOneShot2000 { public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setSize(200, 200); shell.open(); display.timerExec(2000, new Runnable() { public void run() { System.out.println("2000"); } }); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); } }