title: Customize JOptionPane Dialog
body: <p>I am learning java swing. The code below is a catch block which handles an IOException and shows a error message. </p>
  
  <pre><code> catch(IOException e)
      {
          System.out.println("IOException");
          JOptionPane.showMessageDialog(null,"File not found",null,
                                      JOptionPane.ERROR_MESSAGE);
      }
  </code></pre>
  
  <p>I was thinking of declaring and customizing a JOptionPane of my own inside the catch block like the code below:</p>
  
  <pre><code>JOptionPane jop=new JOptionPane();
          jop.setLayout(new BorderLayout());
          JLabel im=new JLabel("Java Technology Dive Log",
                  new ImageIcon("images/gwhite.gif"),JLabel.CENTER);
          jop.add(im,BorderLayout.NORTH);
          jop.setVisible(true);
  </code></pre>
  
  <p>But the problem is that I don't know how to make it appear on the screen as the showMessageDialogue method does. Please help.
  Thanks in advance. </p>