Use the getListeners() method, passing in the Class type of the particular
listener you want. For instance, if you want to remove all of the listeners
for a JTextField, you do this:

      AbstractDocument doc = (AbstractDocument)myTextField.getDocument();
      DocumentListener[] docListeners = (DocumentListener[])
      doc.getListeners(DocumentListener.class);
      for (int i = 0; i < docListeners.length; i++) {
         doc.removeDocumentListener(docListeners[i]);
      }

-----Original Message-----
From: Harish Prabhu [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 28, 2001 9:47 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Removing all listeners for a Component


Hi all,
I added listeners to a particular component using annonymous classes.
Now i want to remove all such listeners that i have added . is  there any 
way to do this ??
Thanks ,
harish
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing
_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing

Reply via email to