This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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
 
Don't get me started about those stupid light bulbs.
 
subject: JList
 
Similar Threads
passing hidden field value to backing bean
List with checkboxes
Grid layout
Updateable JList
Capturing the element in collection that was chosen