I am making a java game and I am trying to set the JFrames icon to a file named f3.png and it is not working. hear is my code:
package t;
import java.awt.Image;
import java.awt.Toolkit;
import java.io.IOException;
import javax.swing.JFrame;
public class t {
public static void main(String[] args) throws IOException {
Image i = Toolkit.getDefaultToolkit().getImage("f3.png");
JFrame frame = new JFrame();
frame.setTitle("test");
frame.setSize(600,600);
frame.setVisible(true);
frame.setResizable(false);
frame.setIconImage(i);
}
}
I ran it and it still had the default icon