I am trying to set the JFrame icon to a custom image I have prepared. I am, however, getting this error when I write this code;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
public class Game
{
ImageIcon logo = new ImageIcon(getClass().getClassLoader().getResource("BounceAroundIcon.png"));
public static void main (String[] args)
{
JFrame window = new JFrame();
window.setContentPane(new GamePanel());
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
window.setResizable(false);
window.pack();
window.setVisible(true);
}
}
This has worked with another project of mine, but here it will not work. I'm new to Java programming, so sorry if this is obviously wrong.