-
Bug
-
Resolution: Fixed
-
P2
-
1.0, 1.0.2
-
1.1
-
x86, sparc
-
solaris_2.4, solaris_2.5, windows_95
-
Not verified
MOUSE_ENTER and MOUSE_EXIT events not generated on TextFields
Here's sample code:
import java.awt.*;
class myButton extends Button {
public myButton(String s) {
super(s);
}
public boolean mouseEnter(Event evt, int x, int y) {
System.out.println("mouseEnter " + evt.target);
return false;
}
public boolean mouseExit(Event evt, int x, int y) {
System.out.println("mouseExit " + evt.target);
return false;
}
public boolean handleEvent(Event evt) {
System.out.println(evt);
if (evt.id == Event.MOUSE_ENTER)
System.out.println(" enter " + evt.target);
else if (evt.id == Event.MOUSE_EXIT)
System.out.println(" exit " + evt.target);
return false;
}
}
class myTextField extends TextField {
public myTextField(String s) {
super(s);
}
public boolean mouseEnter(Event evt, int x, int y) {
System.out.println("mouseEnter " + evt.target);
return false;
}
public boolean mouseExit(Event evt, int x, int y) {
System.out.println("mouseExit " + evt.target);
return false;
}
public boolean handleEvent(Event evt) {
System.out.println(evt);
if (evt.id == Event.MOUSE_ENTER)
System.out.println(" enter " + evt.target);
else if (evt.id == Event.MOUSE_EXIT)
System.out.println(" exit " + evt.target);
return false;
}
}
public class help extends Frame {
public help() {
}
public boolean handleEvent(Event evt) {
if (evt.id == Event.MOUSE_ENTER)
System.out.println(" enter " + evt.target);
else if (evt.id == Event.MOUSE_EXIT)
System.out.println(" exit " + evt.target);
return false;
}
public static void main(String args[]) {
help h = new help();
h.setLayout(new GridLayout(10, 1));
h.add(new myButton("One"));
h.add(new myButton("Two"));
h.add(new myButton("Three"));
h.add(new myTextField("Four"));
h.add(new myTextField("Five"));
h.add(new myTextField("Six"));
h.resize(300, 300);
h.show();
}
}
[aim 11/18/96]
This is a generic problem to more than TextFields.
Currently, mouse events are ONLY generated on Windows, Frames, Dialogs,
Panels and Canvases. This means that no other component can get any
kind of mouse event.
Here's sample code:
import java.awt.*;
class myButton extends Button {
public myButton(String s) {
super(s);
}
public boolean mouseEnter(Event evt, int x, int y) {
System.out.println("mouseEnter " + evt.target);
return false;
}
public boolean mouseExit(Event evt, int x, int y) {
System.out.println("mouseExit " + evt.target);
return false;
}
public boolean handleEvent(Event evt) {
System.out.println(evt);
if (evt.id == Event.MOUSE_ENTER)
System.out.println(" enter " + evt.target);
else if (evt.id == Event.MOUSE_EXIT)
System.out.println(" exit " + evt.target);
return false;
}
}
class myTextField extends TextField {
public myTextField(String s) {
super(s);
}
public boolean mouseEnter(Event evt, int x, int y) {
System.out.println("mouseEnter " + evt.target);
return false;
}
public boolean mouseExit(Event evt, int x, int y) {
System.out.println("mouseExit " + evt.target);
return false;
}
public boolean handleEvent(Event evt) {
System.out.println(evt);
if (evt.id == Event.MOUSE_ENTER)
System.out.println(" enter " + evt.target);
else if (evt.id == Event.MOUSE_EXIT)
System.out.println(" exit " + evt.target);
return false;
}
}
public class help extends Frame {
public help() {
}
public boolean handleEvent(Event evt) {
if (evt.id == Event.MOUSE_ENTER)
System.out.println(" enter " + evt.target);
else if (evt.id == Event.MOUSE_EXIT)
System.out.println(" exit " + evt.target);
return false;
}
public static void main(String args[]) {
help h = new help();
h.setLayout(new GridLayout(10, 1));
h.add(new myButton("One"));
h.add(new myButton("Two"));
h.add(new myButton("Three"));
h.add(new myTextField("Four"));
h.add(new myTextField("Five"));
h.add(new myTextField("Six"));
h.resize(300, 300);
h.show();
}
}
[aim 11/18/96]
This is a generic problem to more than TextFields.
Currently, mouse events are ONLY generated on Windows, Frames, Dialogs,
Panels and Canvases. This means that no other component can get any
kind of mouse event.
- duplicates
-
JDK-1249702 double-click event reported even when mouse moved great distance between clicks
-
- Closed
-