Here you can find the source of runInEDTAndWait(Runnable task)
public static void runInEDTAndWait(Runnable task)
//package com.java2s; // License: GPL. For details, see LICENSE file. import java.lang.reflect.InvocationTargetException; import javax.swing.SwingUtilities; public class Main { public static void runInEDTAndWait(Runnable task) { if (SwingUtilities.isEventDispatchThread()) { task.run();//from w w w. j a v a2s . c om } else { try { SwingUtilities.invokeAndWait(task); } catch (InterruptedException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } } } }