public void callSeriallyAndWait(Runnable r){
  if (isEdt()) {
    throw new RuntimeException("This method MUST NOT be invoked on the EDT");
  }
  RunnableWrapper c=new RunnableWrapper(r,0);
  callSerially(c);
  flushEdt();
synchronized (lock) {
    while (!c.isDone()) {
      try {
        lock.wait(50);
      }
 catch (      InterruptedException err) {
      }
    }
  }
}

public void callSeriallyAndWait ( Runnable r ) { if ( isEdt ( ) ) { throw new RuntimeException ( "This method MUST NOT be invoked on the EDT" ) ; } RunnableWrapper c = new RunnableWrapper ( r , 0 ) ; callSerially ( c ) ; flushEdt ( ) ; synchronized ( lock ) { while ( ! c . isDone ( ) ) { try { lock . wait ( 50 ) ; } catch ( InterruptedException err ) { } } } }
identical to callserially with the added benefit of waiting for the runnable method to complete .
