CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Hybrid View

  1. #1
    Join Date
    Feb 2000
    Location
    Netherlands
    Posts
    25

    Problem with MouseEntered & MouseExited

    Hello,

    I have trouble using the MouseEntered() and MouseExited() methods.

    My implemetation looks like this:

    /* code starts here */
    import java.applet.Applet;
    import java.awt.*;
    import java.awt.image.*;
    import java.awt.event.*;
    import java.io.*;
    import java.net.*;
    import java.util.*;

    public class x extends Applet implements Runnable, MouseListener, MouseMotionListener {
    ..
    ..
    ..
    public void init () {
    addMouseMotionListener(this);
    addMouseListener(this);
    }

    public void destroy() {
    removeMouseListener(this);
    removeMouseMotionListener(this);
    }
    ..
    ..
    ..

    public void mouseEntered(MouseEvent e) {
    System.out.println("debuginfo: mouseEntered");
    // mouse handling code
    }

    public void mouseExited(MouseEvent e) {
    System.out.println("debuginfo: mouseExited");
    // mouse handling code
    }

    public void mouseClicked(MouseEvent e) {
    System.out.println("debuginfo: mouseClicked");
    }

    public void mouseMoved(MouseEvent e) {
    System.out.println("debuginfo: mouseMoved");
    }

    public void mouseDragged(MouseEvent e) {}

    }
    /* code ends here */

    My problem is that both MouseEntered() and MouseExited() do not get called. The other
    mouse methods work just fine. I have no trouble detecting mouse movement or detecting when
    a button is clicked.

    Does anyone know why the MouseEntered() and mouseExited methods do not work. Have I forgotten something? By the way: I am using JDK 1.2.2

    Hendrik


  2. #2
    Join Date
    Feb 2000
    Location
    Netherlands
    Posts
    25

    Re: Problem with MouseEntered & MouseExited

    Ok, a friend helped me out on this one. I created a processMouseEvent method myself overriding the default method. After renaming my method everything works as expected.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured