Start New Discussion within our Software Development Community

I have a gui with an ADD, EDIT, and DELETE button. All of which are not active until you click their respective name from the menu bar. Once I click on the DELETE key in the menu, it actives my delete button fine, but when I select an object from my list (and it is highlighted in blue) and click delete button I just get an error....

Do I have to add anything to my ListSelectionListener method?

Any help?

else if (source == deleteMenuItem) {
					deleteButton.setEnabled(true);
				    status.setText("Click the photo in the list to delete\n"
							+ "Click delete when finished\n");
				}
				else if (source == deleteButton)
				{
					try{
					int index = itemList.getSelectedIndex();
				    itemList.remove(index);
					}
					finally {
						deleteButton.setEnabled(false);
					}
				}

answered my own question in time...

changed the above to:

try{
					int index = itemList.getSelectedIndex();
					ArrayList<Photo> hello = theList.getAlbum();
					Photo ggg = hello.get(index);
					theList.deltePhoto(ggg);
					itemList.setListData(theList.getArray());
					}
					finally {
						deleteButton.setEnabled(false);
This question has already been answered. Start a new discussion instead.