title: Resizing an image in swing
body: <p>I have snippet of code that I am using for the purpose of resizing an image to a curtain size (I want to change the resolution to something like 200 dpi). Basically the reason I need it is because I want to display the image that the user have picked (somewhat large) and then if the user approves I want to display the same image in a different place but using a smaller resolution. Unfortunately, if I give it a large image nothing appears on the screen. Also, if I change </p>
  
  <pre><code>imageLabel.setIcon(newIcon); 
  </code></pre>
  
  <p>to </p>
  
  <pre><code>imageLabel.setIcon(icon); 
  </code></pre>
  
  <p>I get the image to display but not in the correct resolution that's how I know that I have a problem inside this snipper of code and not somewhere else.</p>
  
  <pre><code>Image img = icon.getImage();
  
  BufferedImage(img.getWidth(null), img.getHeight(null), BufferedImage.TYPE_INT_ARGB);
  BufferedImage bi = new BufferedImage(img.getWidth(null), img.getHeight(null), BufferedImage.TYPE_INT_ARGB);
  Graphics g = bi.createGraphics();
  boolean myBool = g.drawImage(img, 0, 0, 100, 100, null);
  System.out.println(myBool);
  ImageIcon newIcon = new ImageIcon(bi);
  imageLabel.setIcon(newIcon);
  submitText.setText(currentImagePath);
  imageThirdPanel.add(imageLabel);
  </code></pre>