code: public static void displayMessageBox( String strMsg, final int iType, boolean bWrapText )
    {
      final String strWrappedMsg = bWrapText ? wrapText( strMsg ) : strMsg;
  
      Runnable logMsgBox = new Runnable()
      {
        public void run()
        {
          JOptionPane.showMessageDialog( getWindow(), strWrappedMsg, "", iType );
        }
      };
  
      if( EventQueue.isDispatchThread() )
      {
        logMsgBox.run();
      }
      else
      {
        try
        {
          EventQueue.invokeAndWait( logMsgBox );
        }
        catch( Throwable t )
        {
          t.printStackTrace();
        }
      }
    }
docs: --------------------------------------------------------------------------------------------------