How to remove all ListSelectionListener?

How can I remove all the listener registered for a specific component.
JeabSMJAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

heyhey_Commented:
usually, you can extend the component and add additional method (the Vector or whatever Object keeps listeners is usually protected field).
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
vivexpCommented:
Hi,
Use this
It is defined in JList class
public void removeListSelectionListener(ListSelectionListener listener)

     Remove a listener from the list that's notified each time a change to the selection occurs.

try out...
0
heyhey_Commented:
it's better to read the question before posting Answer. it's EVEN BETTER to post a COMMENT.

'remove all the listener'
0
Become a CompTIA Certified Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

JeabSMJAuthor Commented:
I've found the method removeListSelectionListener.  The problem is that at the moment I don't know how many listener registered.  I can not provide the parameter listener to remove.
0
heyhey_Commented:
so why don't you use my method ?
0
vivexpCommented:
Hi JeabSMJ ,
the above method can remove a listselection listner for a list
box using the object of that that class.

do want to remove the listselection listener for a list box?
try out...



To hey hey.........
r u the founder of experts-exchange web site. u cant dictate terms..

0
heyhey_Commented:
JeabSMJ wants to remove all the listeners and he does not know the listeners objects. the question is quite clear, and your answer is quite WRONG.

the situation is simple - you can't use
public void removeListSelectionListener(ListSelectionListener listener)

if you don't have the 'listener' object.

and btw. I don't DICTATE anything. I HELP people.

all the best :)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.