Here you can find the source of dispatchToEDT(Runnable runnable)
public static void dispatchToEDT(Runnable runnable)
//package com.java2s; import javax.swing.SwingUtilities; public class Main { public static void dispatchToEDT(Runnable runnable) { if (!SwingUtilities.isEventDispatchThread()) { SwingUtilities.invokeLater(runnable); } else {/* w w w .j av a2 s . co m*/ runnable.run(); } } }