Your badgePath
is null
.
The constructor uses the badgePath
as argument for the ImageIcon
constructor, but it didn't initialize it first. Use a constructor like this:
public badgeIMG(String path)
{
ImageIcon ii = new ImageIcon(this.getClass().getClassLoader().getResource(path));
badgeIcon = ii.getImage();
badgePath = path;
}
Note: Very important: Java naming conventions are that classes start with an uppercase char. So change the class name and file name to: BadgeImg
or BadgeIMG
.