For the javaswing homework, we are required to load the icon array, and the
choice array for which the choice country would correspond to the country
flag icon.
I have set up an icon package to hold the flags; initially, each flag icon
has the country name for each flag, but I had to change the names to image0,
image1, ... so I could use the same loading logics as in the Lunarphases
example, I also had to hard code the country choice array to correspond to
the flag.
Is there a way so that when loading the gif object, to get the object name
so it can be loaded into the choice array at the same time? This would be
so much more flexible and robust.
Here is a snippet of my codes:
//Get the images and put them into an array of ImageIcons.
for (int i = 0; i < NUM_IMAGES; i++) {
images[i] = createImageIcon("/images/image" + i".gif");}
//Create a combo box with country choices.
String[] countries = { "Brazil", "England", "France",
"Nigeria", "Paraguay", "USA" };
Thanks
norman
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---