My image is in the source folder and has a resolution of 32x32 but it still won't change the frame icon.

package pkgCarInsuranceCalc;
 
// imports
import javax.swing.*;
 
public class Run 
{
 
        public static void main(String[] args) 
        {
	CarInsuranceCalc mainFrame = new CarInsuranceCalc();
	mainFrame.setSize(600,450); // set frame dimensions
        mainFrame.setResizable(false);
	mainFrame.setVisible(true); // make frame visible
        mainFrame.setLocationRelativeTo(null); // centre frame
        // close application when frame's X clicked
	mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        // changes icon at the top left of the frame
        mainFrame.setIconImage(new ImageIcon("icon.gif").getImage());
	} // end of main method
 
}