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

MOUSE_ENTERED coordinates incorrect for a java.awt.Frame

XMLWordPrintable

    • b01
    • x86
    • windows_nt
    • Not verified



        Name: chT40241 Date: 11/25/97


        The MOUSE_ENTERED events on a Frame contain incorrect x and y values
        when entering from the top or slowly entering the sides.
        Also, the coordinates for enter and exit do not match when entering and
        exiting at the same point.
        JDK 1.1.5J, Windows NT 4.0 SP3

        *** test2.java ***

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

        // The MOUSE_ENTERED events on a Frame contain incorrect x and y values
        //when entering from the top or slowly entering the sides.
        // Also, the coordinates for enter and exit do not match when entering and
        // exiting at the same point.
        // JDK 1.1.5J, Windows NT 4.0 SP3
        public class test2 {
            public static void main(String[] args) {
                System.out.println("Move the mouse so that the cursor enters the\n" +
                    "frame from the top. Notice bogus coordinates for the ENTERED\n" +
                    "event. Also, when entering and exiting at the same point, the\n" +
                    "coordianates for the ENTERED and EXITED events don't match.\n" +
                    "This bug also occurs when entering other sides of the frame\n" +
                    "very slowly.");
                Frame f = new Frame("test");
                f.setLayout(null);
                f.setBounds(100, 100, 200, 200);

                MouseAdapter ma = new MouseAdapter() {
                    public void mouseEntered(MouseEvent e) {
                        System.out.println(e);

                        // simple test to draw attention to bug
                        if (e.getX() < 0 || e.getX() > 1500)
                            System.out.println("***ERROR*** x coordinate is probably bog
        us.");
                    }

                    public void mouseExited(MouseEvent e) {
                        System.out.println(e);
                    }
                };
                f.addMouseListener(ma);

                f.show();
            }
        }


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

              feckssunw Fred Ecks (Inactive)
              chickeysunw Chuck Hickey (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: