Here you can find the source of runInEventDispatchThread(final Runnable r)
public static void runInEventDispatchThread(final Runnable r)
//package com.java2s; //License from project: Open Source License import javax.swing.SwingUtilities; public class Main { public static void runInEventDispatchThread(final Runnable r) { if (SwingUtilities.isEventDispatchThread()) { r.run();/* w w w .j a v a 2 s .c om*/ } else { SwingUtilities.invokeLater(r); } } }