File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes JList Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JList" Watch "JList" New topic
Author

JList

emma dawdry
Greenhorn

Joined: Mar 30, 2000
Posts: 3
I have a JList populated with data. When the user has double clicked on one of the items in the list, I need to maniupulate that item. I have implemented the MouseListener which returns an index of the row the user has clicked on. How do I then get the actual data from that row back?
I have used a corresponding linkedlist to store the data displayed in the JList, so that I can search through that using the index returned by the mouse click but this seems a bit long-winded
Thanks
Emma
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
From JList: getSelectedValue() should be simplest. Alternately getModel().getElementAt(index) will do it.


"I'm not back." - Bill Harding, Twister
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JList