I have a combobox with list of authors and with change in combobox I have to show the author's detail in table using java swing. I did like:
for(Author author: Application.authors){
jComboBoxAuthors.addItem(author);
}
and with change in item selected :
if(jComboBoxAuthors.getSelectedIndex()>0){
Author author = (Author)e.getItem();
String name = author.getFirstName()+" "+author.getLastName();
}
It shows object in combo but i need the name only and if I dojComboBoxAuthors.addItem(author.getFirstName());
I can't get value in table ie. name return nothing. How can I fix this issue?