I am using a GUI to create a slide show and I have a folder full of images(all the images are .jpg) and I want to be able to read all of them into an array list and display random pictures. I just created a self executable jar file so my friend can run the program on her computer so she doesn't have to deal with any of the code. Right now I am doing this by using an array and a for loop to read in each picture and the name of the picture is a number from 0 to size of the array,
for(int i = 0; i < pic.length-1; i++)
{
pic[i] = new ImageIcon(this.getClass().getResource("/Pictures/"
+ i +".JPG"));
}
By using this method I have to alter the code by resizing the array then add the new picture to the folder and making sure the picture is the correct name. What I want is for my friend to be able to add a picture to the fold that the jar file uses and that would just use the new picture to the slide show but i'm not sure how to read in a picture from a folder with out knowing the name of the picture. I also want to add the pictures to an ArrayList so the size of the ArrayList will be determined by the number of pictures in the folder.