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 selection method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JList selection method" Watch "JList selection method" New topic

JList selection method

Mansoor Akhtar

Joined: Jul 11, 2010
Posts: 12

I would like to know which method is called when a mouse is clicked on a JList item? I mean which method is responsible for its selection?
I need to override that method for some custom behavior.

Darryl Burke

Joined: May 03, 2008
Posts: 4523

Read the sources if you really want to know something that
(a) is undocumented, so may not be the same across all releases
(b) is undocumented, so may not be the same across all Look&Feels
(c) is undocumented, so will almost certainly come back to bite you in the butt when you least expect it.

Do you really need some custom behavior to apply when the user clicks the mouse to make a selection, and normal, decustomised behavior when the selection is made using the keyboard?

What custom behavior?

luck, db
There are no new questions, but there may be new answers.
Rob Spoor

Joined: Oct 27, 2005
Posts: 19651

Isn't that what ListSelectionListeners are for?

How To Ask Questions How To Answer Questions
I agree. Here's the link:
subject: JList selection method
Similar Threads
Combo box selection
JList programmatic selection but no event firing.
preventing selection in JList
JList Selection & Main Execution Thread
Problem with scrollbars in JList