On May 8, 8:57 pm, "* ^ *" <[email protected]> wrote:
> // Names of image files. How can I improve this?
> String[] imgs={"Albania.gif", "Austria.gif", "Cambodia.gif",
> "Croatia.gif", "Lebanon.gif", Malaysia.gif"};
>
> I would like to do this:
> 1. Program reads directory that contains images.
> 2. Put all image file names into an array.
> Any ideas?
>
You may have an array of ImageIcon.
Then an array of countries.
>From the array of countries, you may build a JComboBox and use two
final static int to position the selected index.
Then you iterate over the array of countries to create the ImageIcon
reading the directory where they are.
If you map the name of the image to the array of the countries it
should work.
You may use getResource to retrieve your app resource path.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---