Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.concurrent.*; import javax.swing.*; public class Main { public static void invokeLater(Runnable doRun) { SwingUtilities.invokeLater(doRun); } public static <T> FutureTask<T> invokeLater(Callable<T> doRun) { FutureTask<T> task = new FutureTask<>(doRun); invokeLater(task); return task; } }