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

No mouseExited event when modal dialog pops up

XMLWordPrintable

    • sparc
    • solaris_2.6

      On Solaris, button receive no mouseExited event when overlapped
      by a modal dialog.

      The code below demonstrates the problem. Place mouse pointer over
      the button. It will receive mouseEntered event. Then press the
      button. A modal dialog pops up, but the button receives no
      mouseExited event.

      This bug occurs on Solaris only. It seems to first appear in
      1.1.7 and exist in all versions since. If the dialog is not
      modal, it doesn't occur.

      --------- Test case -----------
      import java.awt.*;
      import java.awt.event.*;

      /* Button doesn't receive mouseExited event when covered by a modal dialog.
       * Run `java AWTDemo' for modal, and
       * `java AWTDemo -ok' for non-modal Dialog
       */
      public class AWTDemo extends Frame {
          Button b1;
          boolean modal;

          public AWTDemo(boolean isModal) {
      super("ButtonDemo");
      modal = isModal;

              b1 = new Button("button");
      b1.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent ae) {
      Dialog d = new Dialog(AWTDemo.this, "foo", modal);
      d.setSize(200,200);
      d.show();
      }
      });
      b1.addMouseListener(new MouseAdapter() {
      public void mouseEntered(MouseEvent ev) {
      b1.setLabel("Entered");
      System.out.println("Entered");
      }
      public void mouseExited(MouseEvent ev) {
      b1.setLabel("Exited");
      System.out.println("Exited");
      }
      });
              add(b1);
          }

          public static void main(String[] args) {
      boolean modal = true;
      if (args.length > 0 && args[0].equals("-ok")) modal = false;
      Frame frame = new AWTDemo(modal);
      frame.pack();
      frame.show();
          }
      }

      ###@###.### 2000-03-10

            Unassigned Unassigned
            peterz Peter Zhelezniakov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: