title: Save Image From JLabel Without JFileChooser
body: <p>I want to save the image FROM JLabel to Folder without JFileChooser. I have a method like this</p>
  
  <pre><code>private void SaveImage(){
          Icon icon = lblPhoto.getIcon();
          BufferedImage bi = new BufferedImage(icon.getIconWidth(), icon.getIconHeight(), BufferedImage.TYPE_INT_RGB);
          ImageIcon ImageIcon = (ImageIcon)lblPhoto.getIcon();
          OutputStream out = null;
          int size =0;
          Image Image = ImageIcon.getImage();
          try {
              out = new FileOutputStream("\\RekamMedis\\Photo\\"+txtNama.getText().trim()+".jpg");
              byte[] b = new byte[size];
              out.write(b);
              ImageIO.write((RenderedImage)Image, "jpg", out);
          } 
          catch (Exception e) {
              Logger.getLogger(lblPhoto.getClass().getName()).log(Level.SEVERE, null, e);
          }
      }
  </code></pre>
  
  <p>But this method show the empty image.jpg or other format. What is the best solution for this problem?? </p>