private static void ensureEventDispatchThread(){
  if (!EventQueue.isDispatchThread()) {
    throw new IllegalStateException("The DialogWrapper can only be used in event dispatch thread. Current thread: " + Thread.currentThread());
  }
}

private static void ensureEventDispatchThread ( ) { if ( ! EventQueue . isDispatchThread ( ) ) { throw new IllegalStateException ( "The DialogWrapper can only be used in event dispatch thread. Current thread: " + Thread . currentThread ( ) ) ; } }
ensure that dialog is used from even dispatch thread .
