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

The behavior of the class java.awt.EventQueue poorly documented.

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      beta
    • CPU:
      sparc
    • OS:
      solaris_2.6

      Description



      Name: dsR10051 Date: 06/23/2000



      The documentation for class java.awt.EventQueue
      says nothing about event dispatch thread associated with this event queue.
      It is unclear that the event posted to event queue
      will be processed by dispatch thread asynchronously.
      Besides it should be documented how the queue and event dispatch thread
      work together.


      Here is a minimized test:
      import java.awt.*;
      import java.awt.event.*;

      public class Test01 {

          public static void main (String[] args) {
              
              EventQueue queue = new EventQueue();
              Component c = new Panel();
              AWTEvent e = new ActionEvent(c, ActionEvent.ACTION_PERFORMED, "COMMAND");
              queue.postEvent(e);
              try {
                  Thread.sleep(10000);
              } catch (Exception ex) {
                  ex.printStackTrace();
              }
              AWTEvent result = queue.peekEvent();
              System.out.println("Event : " + e);
              System.out.println("Result: " + result);
              if (e.equals(result)) {
                  System.out.println("OKAY");
              } else {
                  System.out.println("FAILED");
              }
          }
      }

      --- Output ---
      %/usr/local/java/jdk1.4/solaris/bin/java -version
      java version "1.4.0beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0beta-b20)
      Java HotSpot(TM) Client VM (build 1.3.0rc3-Z, interpreted mode)
      %/usr/local/java/jdk1.4/solaris/bin/java Test01
      Event : java.awt.event.ActionEvent[ACTION_PERFORMED,cmd=COMMAND] on panel0
      Result: null
      FAILED
      ^C
      %

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

        Attachments

          Activity

            People

            Assignee:
            sharonz Sharon Zakhour (Inactive)
            Reporter:
            sdasunw Sda Sda (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: