title: icon not repainting in JoptionPane java
body: <p>My program captures the screen's images, resizes and represents them in a JoptionPane icon filed so that the user can decide weather or not to save them. 
  The prob is that after performing Joption.cancel, the icon shows the previous image the next time the user captures the screen image. in Joption.ok case it works fine.
  Any idea why this happens? the snapshots themselves are well rendered(every snapshot captures the very current screen image but the icon shows the previous one once cancel has been clicked) . </p>
  
  <pre><code>  rszedSnp=ImageMagick.resize(origSnp_name,30);
  ImageIcon icon=new ImageIcon(rszedSnp);
      String userIput = (String)JOptionPane.showInputDialog(
              new JFrame(),
                             "Save as:\n",
                             "taking screen shot",
                             JOptionPane.PLAIN_MESSAGE,
                             icon ,
                            null,
                            origSnp_name);  
  </code></pre>