modified code for JList selection