Java tutorial
//package com.java2s; //License from project: Open Source License import javax.swing.SwingWorker; public class Main { public static void doInBackground(final Runnable r) { new SwingWorker<Void, Void>() { @Override protected Void doInBackground() { r.run(); return null; } }.execute(); } }