title: How to set an ImageIcon to a JButton and resize the picture according to the button's size?
body: <p>I've been wondering how can I set an <code>ImageIcon</code> to a button using the <code>Image</code> path and set it to a <code>JButton</code>?</p>
  
  <p>I can resize the image's size according to the buttons size:</p>
  
  <pre><code>frontViewImageFile = fc.getSelectedFile();
  MainFrame.btnFrontView.setIcon(new ImageIcon(ImageIO.read(
      frontViewImageFile).getScaledInstance(150, 150, Image.SCALE_SMOOTH)));  
  </code></pre>
  
  <p>But the image came from a file chooser and I can use <code>getScaledInstance</code> method to resize the picture.</p>
  
  <p>How can i do this with image path since method <code>getScaledInstance</code> is undefined for the type <code>String</code>?</p>