-
Bug
-
Resolution: Won't Fix
-
P4
-
7
-
sparc
-
solaris
I have a frame & have added a button to it. MouseAdapter is added to the button. When i move the mouse inside the button, the mouseEntered event is triggered. When i click the button to show the dialog & close the dialog by clicking the close button of the dialog, where the mouse is moved outside the button. Now when the mouse is brought back on the button on the frame , mouse entered event is triggered. But mouseExit event is not triggered. Which is incorrect. This happens on windows. This is reproducable from 1.4.2 onwards to 6u5 b04 build the same can be observed in jdk7 b22 also. On solaris there is an inconsistency in mouseexit. If i move the mouse fast on the button after closing the dialog , mouseexit is not triggered. but if i move the mouse slow , mouse exit event is triggered.
Source code
----------
import java.awt.Frame;
import java.awt.Button;
import java.awt.Choice;
import java.awt.TextField;
import java.awt.Dialog;
public class MouseExitnotTriggered extends java.awt.event.MouseAdapter {
Frame frame=null;
Button b=null;
Choice ch=null;
TextField tf=null;
MouseExitnotTriggered() {
frame = new Frame();
b = new Button("Press Me");
b.addActionListener(new java.awt.event.ActionListener(){
public void actionPerformed(java.awt.event.ActionEvent ae){
Dialog d = new Dialog(frame,"modal dialog",true);
d.setLayout(new java.awt.FlowLayout());
d.add(new Button("Press Me"));
d.addWindowListener(new java.awt.event.WindowAdapter(){
public void windowClosing(java.awt.event.WindowEvent we){
we.getWindow().dispose();
}
});
d.setSize(200,200);
d.setVisible(true);
}
});
b.addMouseListener(this);
frame.add(b);
frame.setLayout(new java.awt.FlowLayout());
frame.setLocation(200,200);
frame.pack();
frame.setVisible(true);
}
public void mouseEntered(java.awt.event.MouseEvent me ){
System.out.println("mouse entered component = " +me.getComponent().getCursor());
}
public void mouseExited(java.awt.event.MouseEvent me) {
System.out.println("mouse exit component = " +me.getComponent().getCursor());
}
public void mousePressed(java.awt.event.MouseEvent me) {
System.out.println("mouse Pressed component = " +me.getComponent().getCursor());
}
public void mouseReleased(java.awt.event.MouseEvent me){
System.out.println("mouse Released component = " +me.getComponent().getCursor());
}
public static void main(String []args){
new MouseExitnotTriggered();
}
}
--------------------------------------------------------
Step to reproduce:
-------------------
1) Run the above testcase.
2) Move the mouse on the button. Observe a mouse Entered event is triggered & can be seen on console.
3) Click the button, mousePressed & mouseRelease events are trigger. You can see a dialog.
4) Close the dialog , by clicking the close button of the dialog. The dialog gets disposed.
5) Move the mouse on the button. Observe that mouseEnter event is triggered not mouseExit( pending event ) .If you see the same then the bug is reproduced.
Source code
----------
import java.awt.Frame;
import java.awt.Button;
import java.awt.Choice;
import java.awt.TextField;
import java.awt.Dialog;
public class MouseExitnotTriggered extends java.awt.event.MouseAdapter {
Frame frame=null;
Button b=null;
Choice ch=null;
TextField tf=null;
MouseExitnotTriggered() {
frame = new Frame();
b = new Button("Press Me");
b.addActionListener(new java.awt.event.ActionListener(){
public void actionPerformed(java.awt.event.ActionEvent ae){
Dialog d = new Dialog(frame,"modal dialog",true);
d.setLayout(new java.awt.FlowLayout());
d.add(new Button("Press Me"));
d.addWindowListener(new java.awt.event.WindowAdapter(){
public void windowClosing(java.awt.event.WindowEvent we){
we.getWindow().dispose();
}
});
d.setSize(200,200);
d.setVisible(true);
}
});
b.addMouseListener(this);
frame.add(b);
frame.setLayout(new java.awt.FlowLayout());
frame.setLocation(200,200);
frame.pack();
frame.setVisible(true);
}
public void mouseEntered(java.awt.event.MouseEvent me ){
System.out.println("mouse entered component = " +me.getComponent().getCursor());
}
public void mouseExited(java.awt.event.MouseEvent me) {
System.out.println("mouse exit component = " +me.getComponent().getCursor());
}
public void mousePressed(java.awt.event.MouseEvent me) {
System.out.println("mouse Pressed component = " +me.getComponent().getCursor());
}
public void mouseReleased(java.awt.event.MouseEvent me){
System.out.println("mouse Released component = " +me.getComponent().getCursor());
}
public static void main(String []args){
new MouseExitnotTriggered();
}
}
--------------------------------------------------------
Step to reproduce:
-------------------
1) Run the above testcase.
2) Move the mouse on the button. Observe a mouse Entered event is triggered & can be seen on console.
3) Click the button, mousePressed & mouseRelease events are trigger. You can see a dialog.
4) Close the dialog , by clicking the close button of the dialog. The dialog gets disposed.
5) Move the mouse on the button. Observe that mouseEnter event is triggered not mouseExit( pending event ) .If you see the same then the bug is reproduced.