tags:

views:

80

answers:

2

I need to create a simple array of some images. So that later on I can traverse through the array easily using a loop and access all the images one by one.

Just tell me the declaration part of storing the images into an array.

I'l be having 5 images named as 1.png to 5.png which I need to access. Will it be a string array or integer array?

Thanks

+2  A: 

Array of ImageIcon:

ImageIcon[] images = new ImageIcon[5];
images[0] = new ImageIcon("path/to/image");
....
tulskiy
+1  A: 

Your question is confusing. You clearly know what an array is and how to use it, but you don't know what type to use? Why, whichever type you want to use, of course. You could use String, or whatever class you usually use to represent an image.

Chris