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

An alternative to isPopupTrigger() functionality



    • Subcomponent:
    • Resolved In Build:
    • CPU:
      generic, x86
    • OS:
      solaris_2.5, windows_nt


      For context look at bug number 4119064 and 4126592 and 4029723 and
      4063318. This reenforces my point that many people are doing the
      same mistake and it either needs to be handled by a strong documentation
      or alternate implementation like I have proposed.

      sandip.chitale@Eng 1998-04-20

      It has been a common mistake made by a lot of people including
      myself to check for isPopupTrigger() in either mousePressed or
      mouseReleased and not both. The code seems to work on either
      CDE/Motif or WindowsOne and not both. One can argue that the programmer
      was stupid and should should check for isPopupTrigger()
      in both mousePressed and mouseReleased, however if many people
      are doing the same mistake (as indicated by the code in the
      original bug and code in the workaround) may be it should
      implemented in a different way. Here goes ...

      May be a new Event type PopupMenuTriggerEvent needs to be created
      and the Component class fires it in its processMouseEvent()
      method. The PopupMenuTriggerEvent may contain the original
      event (Mouse or Keyboard) that caused the trigger.

      This will ofcourse also require -

      public void addPopupMenuTriggerListener(PopupMenuTriggerListener pmtl);
      public void removePopupMenuTriggerListener(PopupMenuTriggerListener pmtl);

      and corresponding PopupMenuTriggerListener class.

      This will also allow keyboard mnemonics to be used to pop the
      popup menu (for Accesibility).

      sandip.chitale@Eng 1998-04-07

      Name: krT82822 Date: 02/15/2000

      java version "1.3.0rc1"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0rc1-T)
      Java HotSpot(TM) Client VM (build 1.3.0rc1-S, mixed mode)

      My program needs NEEDS to know whether a popup ocured during a MOUSE_PRESSED
      message; by the time a MOUSE_RELEASED message comes, it is too late, as my
      program performs specific tasks during a MOUSE_PRESSED, that it would not if a
      popup is in progress. As a workaround, I must check to see if the left mouse
      button is down during a MOUSE_PRESSED message. This is not portable.

      Instead of documenting the fact that popup triggers can't be detected during a
      MOUSE_PRESSED, I suggest instead that you enable detection of popup triggers
      durring a MOUSE_PRESSED. Perhaps there are portability issues constraining you
      from doing this, but as it stands, it I cannot write a portable Java program
      that depends on the detection of a popup during a MOUSE_PRESSED message.
      (Review ID: 101197)


          Issue Links



              sharonz Sharon Zakhour (Inactive)
              duke J. Duke (Inactive)
              0 Vote for this issue
              0 Start watching this issue