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

Event Dispatch On Main Thread

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Won't Fix
    • P4
    • None
    • 6
    • client-libs
    • None
    • generic
    • generic

    Description



      Name: rr100577 Date: 02/14/2002


      PROBLEM:

      When starting a Java GUI application that includes multiples threads, for example an application that dynamically streams in data to be displayed, there is a period of time when AWT events can not be handled correctly. This can cause problems in the application itself in recovering from lost or out of sequence events.

      PROPOSAL:

      Allow the app to turn off the EventDispatchThread and dispatch
      events under the control of the main thread. This eliminates
      the extra thread and allows the app to process events when it is ready.

      CHANGES:

      EventDispatchThread.java:

          // Returns the state of the AutoDispatch mode of the EventDispatchThread,
          // which is true by default.
          public boolean getAutoDispatch();

          // Sets the state of the AutoDispatch mode of the EventDispatchThread.
          public setAutoDispatch(boolean mode);


      EventQueue.java

          /**
           * Dispatches an event. The manner in which the event is
           * dispatched depends upon the type of the event and the
           * type of the event's source object:
          ...
          public void dispatchEvent(AWTEvent event);

          // Convenience method for app to call for event delivery.
          // In a loop it calls getNextEvent() and dispatchEvent() for each
          // event on the EventQueue, until a shutdown event arrives.
          public eventDispatchLoop();


      ======================================================================

      Attachments

        Issue Links

          Activity

            People

              art Artem Ananiev (Inactive)
              rraysunw Richard Ray (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: