Link to home
Start Free TrialLog in
Avatar of JeabSMJ
JeabSMJ

asked on

How to remove all ListSelectionListener?

How can I remove all the listener registered for a specific component.
ASKER CERTIFIED SOLUTION
Avatar of heyhey_
heyhey_

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of vivexp
vivexp

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...
it's better to read the question before posting Answer. it's EVEN BETTER to post a COMMENT.

'remove all the listener'
Avatar of JeabSMJ

ASKER

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.
so why don't you use my method ?
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..

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 :)