你好!将 ImageIcon 设置为 Jframe 和其他组件似乎不起作用。我需要帮助

Hi! setting ImageIcon to a Jframe and other component dont seem to work. I need help pls

我正在尝试为 Window 在左上角设置一个图标。但似乎不起作用.. 你认为问题出在哪里? 我还尝试在 JLabel 的实例上设置图标和文本,但只有文本出来。

link是我制作的JFrame的输出截图。

public class Window extends JFrame{
    
    private final int WIDTH  = 600;

    public Window(){
    // Setting the Window
        setTitle("Module Organizer");
        ImageIcon img = new ImageIcon("checkmark-square.png");
        setIconImage(img.getImage());
        setSize(WIDTH,(WIDTH*3)/4);
        setLocationRelativeTo(null);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setLayout(new BorderLayout());

        // adding components
        
        add(new NavPane(), BorderLayout.WEST);
        
        setVisible(true);
    }

}

这是代码

 import javax.swing.JFrame;
 import javax.swing.ImageIcon;
 import javax.swing.JPanel;
 import javax.swing.JLabel;
 public class Window{
 JFrame f=new JFrame("Test");
 public Window(){
 JPanel j=new JPanel();

 f.setSize(1000,500);
 ImageIcon img = new ImageIcon("Image.jpg");
 f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 JLabel l=new JLabel(img);
 j.add(l);
 f.add(l);
 f.setVisible(true);
}
 public static void main(String[] args) {
    new Window();
}
 }