Removing from JList
I have a JList comprised of People object. What I want to do is when the user right clicks on one of the People objects an option comes up (in menu form or something) that says remove. Upon clicking remove, I want the person object removed from the JList.
Any suggestions on how to implement this?
Thank you.
# 1
> What I want to do is when the user right clicks on one of the People objects an option comes up (in menu form or something) that says remove
Use a JPopupMenu. See http://java.sun.com/docs/books/tutorial/uiswing/components/menu.html#popup
> Upon clicking remove, I want the person object removed from the JList.
Use the JList's model (DefaultListModel). It has a remove( ) methods which work with an Object or an index. See "How To Use JList" http://java.sun.com/docs/books/tutorial/uiswing/components/list.html#mutable
If you dont have the JDK Documentation and Tutorials, I suggest you download them for easy referencing when coding. See Tutorials: http://java.sun.com/docs/books/tutorial/information/download.html
Documentation: http://java.sun.com/javase/downloads/index.jsp
ICE