File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 Java Interview Guide this week in the Jobs Discussion 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!