I have done the Swing homework, but am now attempting it again with
the GUI Builder. I am at the comboBox stage.
I have written code in the source that: Seek the image directory.
Extract all image files' name. Then remove its file extension. Finally
use the resulting String[] to populate the comboBox. Below are the
relevant code fragments:
// Returns path of image directory
getImageDirectory();
// Returns images name from image directory
getImagesName();
// Remove the file extension from images name
removeFileExtension();
// Initialise comboBox with teams and set initial team.
private void populateTeams(){
String[] teams=removeFileExtension(getImagesName());
jComboBox1.removeAllItems();
for(String team : teams) {
jComboBox1.addItem(team);
}
jComboBox1.setSelectedIndex(0);
}
But all the above codes does not affect any change in the comboBox. It
still shows <item 1>.. <Item 4>.
Any ideas how I can overcome this? Thank you.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---