Java examples for Swing:Swing Thread
run On Swing Thread
//package com.java2s; public class Main { public static void runOnSwingThread(Runnable run) { if (javax.swing.SwingUtilities.isEventDispatchThread()) { run.run();/* w w w . ja v a 2s . com*/ } else { runOnSwingThreadLater(run); } } public static void runOnSwingThreadLater(Runnable run) { javax.swing.SwingUtilities.invokeLater(run); } }