Here you can find the source of invokeLater(final Runnable r)
public static void invokeLater(final Runnable r)
//package com.java2s; import javax.swing.SwingUtilities; public class Main { public static void invokeLater(final Runnable r) { if (SwingUtilities.isEventDispatchThread()) { r.run();// w ww. j a v a 2 s. c o m } else { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { r.run(); } }); } } }