private void invokeAndWait(Runnable run){
  if (!SwingUtilities.isEventDispatchThread()) {
    try {
      SwingUtilities.invokeAndWait(run);
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
 else {
    run.run();
  }
}

private void invokeAndWait ( Runnable run ) { if ( ! SwingUtilities . isEventDispatchThread ( ) ) { try { SwingUtilities . invokeAndWait ( run ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } else { run . run ( ) ; } }
if not in the event thread run via swingutilities . invokeandwait ( )
