Here you can find the source of invokeLaterOnEDT(Runnable runnable)
public static void invokeLaterOnEDT(Runnable runnable)
//package com.java2s; /******************************************************************************* * Copyright (c) 2014 Open Door Logistics (www.opendoorlogistics.com) * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU Lesser Public License v3 * which accompanies this distribution, and is available at http://www.gnu.org/licenses/lgpl.txt ******************************************************************************/ import javax.swing.SwingUtilities; public class Main { public static void invokeLaterOnEDT(Runnable runnable) { try {/*from www . j a va 2 s.c o m*/ if (SwingUtilities.isEventDispatchThread()) { runnable.run(); } else { SwingUtilities.invokeLater(runnable); } } catch (Throwable e) { throw new RuntimeException(e); } } }