Image Icon not working for JLabel

126 views Asked by At

I've created a folder in my project that stores 19 images, which I store in an array.
My JLabel cycles through the images (so far only goes to next image), but is not working.

ImageIcon[] front_imagelist = new ImageIcon[19];

for(int i=0; i<front_imagelist.length; i++){
    front_imagelist[i] = new ImageIcon(getClass().getResource(
        "/ben/li/summative/frontimage/" + front_imagenames[i]));
}

if(count<front_imagenames.length){
    c1.setIcon(front_imagelist[count]);
    count++;
}

This was how I initialized the array, though I'm certain this isn't the problem.
The issue is certainly in the above block of code ^

//filename of frontcard images
String[] front_imagenames = {"2a.PNG","3a.PNG","4a.PNG","5a.PNG","6a.PNG","7a.PNG",
    "8a.PNG","9a.PNG","10a.PNG","11a.PNG","12a.PNG","13a.PNG",
    "14a.PNG","15a.PNG","16a.PNG","17a.PNG","18a.PNG","19a.PNG",};
0

There are 0 answers