HendrikG
February 28th, 2000, 02:54 AM
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
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