void invokeAndWait(final Runnable r){
  final CountDownLatch latch=new CountDownLatch(1);
  queue.postRunnable(null);
  try {
    latch.await();
  }
 catch (  InterruptedException e) {
  }
}

void invokeAndWait ( final Runnable r ) { final CountDownLatch latch = new CountDownLatch ( 1 ) ; queue . postRunnable ( null ) ; try { latch . await ( ) ; } catch ( InterruptedException e ) { } }
posts a runnable to the javafx event queue and waits for the runnable to complete .
