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

Extra mouseExited event sent to Panel when clicking on embedded Choice (1.1.x)

    Details

    • Subcomponent:
    • CPU:
      sparc
    • OS:
      solaris_2.5.1, solaris_7

      Description

      orig synopsis: "Superfluous mouseEnter mouseExit events delivered to Panel"

      Name: joT67522 Date: 01/12/98


      Frame contains a panel which contains a single Choice.
      Mouse listener is registered with the panel.

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

      public class MyFrame extends Frame
      {
              class comp extends Panel{

                      public Choice choice;

                      public comp(){
                      add(choice = new Choice());
              choice.addFocusListener(new FocusAdapter()
              {
                  public void focusGained(FocusEvent e)
                  {
                                      if (e.isTemporary())
                                              System.out.println("list got temporary focus");
                                      else
                              System.out.println("list got focus");
                  }
                  public void focusLost(FocusEvent e)
                  {
                                      if (e.isTemporary())
                          System.out.println("list lost temporary focus");
                      else
                              System.out.println("list lost focus");
                  }
              });

                              choice.add("item 1");
                              choice.add("item 2");
                              choice.add("item 3");
                              choice.add("item 4");
                              choice.add("item 5");
                  addMouseListener(new MouseAdapter()
                  {
                      public void mouseClicked(MouseEvent e)
                      {
                          e.consume();
                          System.out.println("Mouse clicked in Panel");
                      }

                      public void mousePressed(MouseEvent e)
                      {
                          e.consume();
                          System.out.println("Mouse pressed in Panel");
                      }

                      public void mouseReleased(MouseEvent e)
                      {
                          e.consume();
                          System.out.println("Panel Mouse released");
                      }
                      public void mouseEntered(MouseEvent e)
                      {
                          e.consume();
                          System.out.println("Panel Mouse entered");
                      }
                      public void mouseExited(MouseEvent e)
                      {
                          e.consume();
                          System.out.println("Panel Mouse exited");
                      }
                  });
                  addMouseMotionListener(new MouseMotionAdapter()
                  {
                      public void mouseDragged(MouseEvent e)
                      {
                          e.consume();
                          System.out.println("Mouse dragged Panel");
                      }
                      public void mouseMoved(MouseEvent e)
                      {
                          e.consume();
                          System.out.println("Mouse moved Panel");
                      }
                  });
                      }

              };

              public MyFrame() {
                      super();
                      comp c = new comp();
                      add("Center",c);
              }

              public Insets getInsets()
              {
                      return new Insets(50,50,50,50);
              }

              public static void main(String [] args) {
                      MyFrame f = new MyFrame();
                      f.pack();
                      f.setVisible(true);
              }
      }
      Run the above code

      1. Move mouse over choice. You will see mouseEnter, several
      mouseMoved and mouseExit event notifications from Panel
      containing this Choice. OK, as you enter Choice, you get
      mouseExit because you really exited and area of Panel.

      2. Click on the Choice and don't release the mouse button
      You will see 2 mouseExited event notifications from Panel
      among several focus lost/gained events from Choice
      (filed under separate bug report). There shouldn't
      be any mouseExit events received by Panel at all!

      3. Release the mouse button to select an item from Choice.
      You will get mouseEntered event notification from Panel
      There shouldn't be one at all. We never left/reentered
      the container Panel while selection from Choice was
      in progress.


      Solaris 2.5, CDE (Common Desktop Environment) window manager
      Sparc station 5
      (Review ID: 23056)
      ======================================================================

        Attachments

          Activity

            People

            • Assignee:
              bchristi Brent Christian
              Reporter:
              johsunw Joon Oh (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: