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

win32: selecting menu item causes bogus mouse click event

    XMLWordPrintable

Details

    • b01
    • generic, x86
    • generic, windows_nt
    • Not verified

    Description


      This is with JDK1.1.1 on win32 only. It doesn't happen with JDK 1.1 and
      it doesn't happen on Solaris.

      If you select a menu item, then when you release the mouse the underlying
      window gets a bogus mouseClicked event.

      I ran into this with the BeanBox where some of the menu items cause you to
      start a sequence where you have to click on a target bean or on a target
      location in the BeanBox. I discovered I was getting a bogus mouseclick
      under where the MenuItem had been. Unfortunately it's relatively difficult to
      workaround as there is no obvious way to spot that the mouse click event is
      really a bogus side-effect of the menu action.

      The following code fragment demos the problem. Select the bargle menuitem
      and you will get a gratuitous "clicked" message.

      KGH 3/18/97

      import java.awt.*;
      import java.awt.event.*;
       
      public class MenuClick extends Frame implements MouseListener {
       
          MenuClick() {
              super("MenuClick");
              setSize(200,200);
       
              MenuBar bar = new MenuBar();
              Menu m = new Menu("foo");
              bar.add(m);
              m.add(new MenuItem("argle"));
              m.add(new MenuItem("bargle"));
              setMenuBar(bar);
       
              addMouseListener(this);
       
              show();
          }
       
          public void mouseClicked(MouseEvent evt) {
              System.err.println("clicked");
          }
       
          public void mousePressed(MouseEvent evt) {
              System.err.println("pressed");
          }
       
          public void mouseReleased(MouseEvent evt) {
              System.err.println("released");
          }
       
          public void mouseEntered(MouseEvent evt) {
          }
       
          public void mouseExited(MouseEvent evt) {
          }
       
          public static void main(String argv[]) {
              new MenuClick();
          }
      }

      Attachments

        Activity

          People

            jlockesunw Jonathan Locke (Inactive)
            ghamiltosunw Graham Hamilton (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: