title: Java: open image on a jlabel
body: <p>I have seen tons of questions about this thing but i just cant completely understand why it doesnt work.
  I want to open an image using JFileChooser and then show it on the jLabel on the other jFrame. So why it doesnt work? What is so wrong about it?</p>
  
  <pre><code>JFileChooser fileopen = new JFileChooser(); 
  int ret = fileopen.showDialog(null, "Open file");
  if (ret == JFileChooser.APPROVE_OPTION) {
  File file = fileopen.getSelectedFile();
  Icon icon = fileopen.getIcon(file);
  origin.jLabel1.setIcon(icon);}
  </code></pre>
  
  <p>By the way will it work for .bmp files, not only .jpg, .png and .gif?</p>