title: Set icon in JFrame
body: <p>I want to change the icon of the project instead of java icon. When the program icon is being displayed in status bar, it should be displaying the customized icon instead of default java icon.</p>
  
  <p>I am using the following code. Please suggest me what's wrong in this code.</p>
  
  <pre><code>class newframe extends JFrame 
  {
  
      Container cp;
      newframe()
      {
          cp=this.getContentPane();
          cp.setLayout(null);
      }
  
      public static void main(String args[])
      {
          newframe frm= new newframe(); 
  
          frm.setbounds(0,0,1000,800);
          frm.setVisible(true);
          ImageIcon im1= new ImageIcon("path upto image");
          frm.setIconImage(im1.getImage());
      }
  }
  </code></pre>