public static void safeInvokeLater(Runnable runnable){
  if (EventQueue.isDispatchThread())   runnable.run();
 else   SwingUtilities.invokeLater(runnable);
}

public static void safeInvokeLater ( Runnable runnable ) { if ( EventQueue . isDispatchThread ( ) ) runnable . run ( ) ; else SwingUtilities . invokeLater ( runnable ) ; }
invokeslater if not already in the dispatch thread .
