Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4257604

Button: getListeners() returning incorrect value.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P2 P2
    • None
    • 1.3.0
    • client-libs
    • sparc
    • solaris_2.6

      Button implementation of getListeners() returns incorrect value for PropertyChangeListener.

      getListeners() in the following program returns 0 for PropertyChangeListner all the time no matter how many PropertyChangeListeners you add.

      --------------------------------- Cut Here -------------------------------------

      import java.awt.*;
      import java.beans.*;
      import java.util.*;

      public class TestGetListenersForButton
      implements PropertyChangeListener{

          Button aComp = new Button();
          EventListener[] eventListener;

          public TestGetListenersForButton() {
              eventListener = aComp.getListeners(PropertyChangeListener.class);
              System.out.println("Before adding a listener: " + eventListener.length);

              aComp.addPropertyChangeListener(this);

              eventListener = aComp.getListeners(PropertyChangeListener.class);
              System.out.println("After adding a listener: " + eventListener.length);
          }

          public void propertyChange(PropertyChangeEvent e) {}

          public static void main(String[] args) {
              new TestGetListenersForButton();
          }
      }


      --------------------------------- Cut Here -------------------------------------

      edmund.lou@eng 1999-07-27
      JFC SQE

            elousunw Edmund Lou (Inactive)
            elousunw Edmund Lou (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: