Java tutorial
//package com.java2s; //License from project: Open Source License import javax.swing.SwingUtilities; public class Main { public static void invokeAndContiune(Runnable runnable) { if (SwingUtilities.isEventDispatchThread()) { runnable.run(); } else { SwingUtilities.invokeLater(runnable); } } }