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

Toolkit does not dispatch ActionEvents to registered listeners

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 5.0
    • client-libs
    • x86
    • windows_xp

      FULL PRODUCT VERSION :
      java version "1.5.0_09"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_09-b01)
      Java HotSpot(TM) Client VM (build 1.5.0_09-b01, mixed mode)

      java version "1.6.0-rc"
      Java(TM) SE Runtime Environment (build 1.6.0-rc-b104)
      Java HotSpot(TM) Client VM (build 1.6.0-rc-b104, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Windows XP

      A DESCRIPTION OF THE PROBLEM :
      The toolkit does not dispatch ActionEvents to the registered listeners. This problem occurs in both 1.5 and 1.6.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Register an AWTEventListener on the default Toolkit to receive ActionEvents. Use a component (such as JButton) to generate ActionEvents. Observe the your listener does not receive any action events.



      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      AWTEventListeners registered on the default Toolkit to receive ActionEvents should receive ActionEvents.

      The expected output of the included test program is the string representation of the ActionEvent printed whenever the button is clicked.
      ACTUAL -
      AWTEventListeners registered on the default Toolkit to receive ActionEvents do not receive ActionEvents.

      The actual output of the included test program is nothing.


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.AWTEvent;
      import java.awt.Toolkit;
      import java.awt.event.AWTEventListener;
      import javax.swing.JButton;
      import javax.swing.JFrame;

      public class ToolkitEventBug {
          public static void main(String[] args) {
              Toolkit kit = Toolkit.getDefaultToolkit();
              kit.addAWTEventListener(new AWTEventListener() {
                  public void eventDispatched(AWTEvent event) {
                      System.out.println("++++\n" + event + "----");
                  }
              }, AWTEvent.ACTION_EVENT_MASK);

              JFrame frame = new JFrame();
              frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
              frame.add(new JButton("Click"));
              frame.pack();
              frame.setVisible(true);
          }
      }
      ---------- END SOURCE ----------

            son Oleg Sukhodolsky (Inactive)
            dav Andrei Dmitriev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: