0

Hello there I know there are other threads like this many with solutions that I have tried but to no avail. The main thing is I keep getting a NullPointerException each time! I am not sure where I am going wrong, here is what I have in my method:

 public Image getIcon() {

    URL iconURL = getClass().getResource("src/images/convert.png");
    // iconURL is null when not found
    ImageIcon icon = new ImageIcon(iconURL);

    return icon.getImage();
}

then I am calling this method after i have created my JFrame,

        frame.setIconImage(model.getIcon());

but I am still getting this nullpointer.

EDIT: this is the file tree..

enter image description here

Adonis
  • 4,670
  • 3
  • 37
  • 57
Maiwand
  • 73
  • 8

0 Answers0