title: Fastest way to create a Java message dialog (swing/awt/other)?
body: <p>I'm creating a Java application that will do some processing then needs to display a message to give the user feedback.</p>
  
  <p>However, it appears to be incredibly slow - taking over two seconds to return.</p>
  
  <p>I stripped the source down to the apparent culprit, and here is the code used:</p>
  
  <pre><code>package SwingPlay;
  
  import javax.swing.JFrame;
  
  public class Dialog
  {
  
      public static void main( String[] args )
      {
          JFrame frame = new JFrame( "DialogDemo" );
      }
  
  }
  </code></pre>
  
  <p>I'm executing this from the command line with:</p>
  
  <pre><code>java -classpath . SwingPlay.Dialog
  </code></pre>
  
  <p>As you can see - I'm doing nothing but create a JFrame, not even displaying it.</p>
  
  <p>In case it is relevant, here is my <code>java -version</code> output:</p>
  
  <pre><code>java version "1.6.0_11"
  Java(TM) SE Runtime Environment (build 1.6.0_11-b03)
  Java HotSpot(TM) Client VM (build 11.0-b16, mixed mode, sharing)
  </code></pre>
  
  <p>And this is (currently) running against Win XP SP2.</p>
  
  <hr/>
  
  <p>So, first question: Why is it so slow?</p>
  
  <p>More importantly, I just want a simple message (GUI, not cmdline) to be displayed without delay - can anyone provide some code to do this?</p>
  
  <hr/>
  
  <p><strong>Update:</strong></p>
  
  <p>A bit of background might be helpful:<br/>
  I am creating an application which will have many 'heads' (i.e. different user interfaces all using the same core classes to do the complex parts).
  <br/>
  I currently have a pure command line head which works fine - responds straight away.
  <br/>I will also have a standard application with a regular point &amp; click GUI, and don't foresee problems with this bit.
  <br/>What I am currently working on is a hybrid of these two - it will be launched from a Run box (or similar launcher), possibly with arguments, and only needs to respond with, effectively, a status message, that can be dismissed with a key press.</p>
  
  <p>This latter one is where the question is focused.</p>
  
  <p>Whilst I am not opposed to using my existing command line version with shell scripts (though didn't think it would be necessary!), the existing answers seem to suggest that things are not running as fast for me as they are for others - one example takes 1460ms for me, versus 70ms - a significant difference.</p>