This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori 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 OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JList" Watch "JList" New topic


emma dawdry

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
Jim Yingst

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:
subject: JList
It's not a secret anymore!