Sorry newbie here. I get an error in Netbeans while trying to add an Icon to a J label. The error is:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException: Cannot invoke "java.net.URL.toExternalForm()" because "location" is null
After importing all of the images I used for my project. I still get this error.
This is the code in default in Netbeans:
diceButton = new javax.swing.JButton();
diceButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resources/dice.png"))); // NOI18N
(https://i.stack.imgur.com/VCANk.png)
I'm expecting to add it to a jlabel so that the image will also be at the jar file