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

processFocusEvent not invoked when FocusEvent is posted to event queue

XMLWordPrintable

    • generic
    • generic

      This is reproducible on Linux and Windows platforms with jdk7 b27 PIT build. Not reproducible with 6u10 b23.

      processFocusEvent method of a component is not called when a FocusEvent is dispatched to event queue even after enableEvents is called for the component.

      To reproduce:
      Run the below test. If a message 'processing focus event' is not printed on console, but is reproduced.

      import java.awt.*;
      import java.awt.event.*;

      public class TestButton extends Button {
          
          public TestButton() {
              enableEvents(AWTEvent.FOCUS_EVENT_MASK);
          }

          public void processFocusEvent(FocusEvent fe) {
              System.out.println("processing focus event");
              System.exit(0);
          }
          
          public static void main(String[] args) {
              TestButton b = new TestButton();
              EventQueue eventQ = new EventQueue();
              FocusEvent focusEvent = new FocusEvent(b, FocusEvent.FOCUS_GAINED);
              eventQ.postEvent(focusEvent);
          }
      }

            ant Anton Tarasov (Inactive)
            gramachasunw Girish Ramachandran (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: