-
Bug
-
Resolution: Cannot Reproduce
-
P4
-
None
-
1.1.6, 1.2.0
-
generic, x86
-
generic, windows_95
Name: paC48320 Date: 05/13/98
Java application window is hidden under another window by the mouseEntered event.
Following instruction and code demonstrates the problem.
1.Run the java program and place the window on the another window.
e:\test java TestW
+---------+
|TestW | X
+-| |----------------+
| | Y | Window B |
| +---------+ |
2.Set the mouse focus to the desk top window by pressing the mouse left
button there.
3.Move the mouse cursor from the desk top window to the test program
window, i.e., from the position X to Y in the figure above. Do not
move mouse cursor into the black box area in the TestW window because
it will cause exception. I'll report this in another submission
as it seems to be different bug.
4.The TestW window is automatically hidden under another window, i.e.,
Window B in the figure above.
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class TestW extends Applet implements MouseListener
{
Window wi = null;
public static void main(String[] args)
{
Frame f = new Frame("TestW");
TestW tw = new TestW();
tw.init();
f.setLayout(new GridLayout(1,1));
f.add(tw);
f.setVisible(true);
f.setSize(f.getPreferredSize());
}
public Dimension getPreferredSize(){
return new Dimension(100,100);
}
public void init(){
addMouseListener(this);
}
public void mouseEntered(MouseEvent e){
Component parent = getParent();
Frame frame = null;
while (parent != null){
if(parent instanceof Frame){
frame = (Frame)parent;
break;
}
parent = parent.getParent();
}
if(frame!=null){
wi = new Window(frame);
wi.setBackground(Color.black);
Point r = getLocationOnScreen();
wi.setVisible(true);
wi.setBounds(r.x+25,r.y+25,50,50);
}
}
public void mouseExited(MouseEvent e){
if(wi!=null){
wi.setVisible(false);
wi.dispose();
wi=null;
}
}
public void mousePressed(MouseEvent e){}
public void mouseReleased(MouseEvent e){}
public void mouseClicked(MouseEvent e){}
}
(Review ID: 30053)
======================================================================
- duplicates
-
JDK-4138231 [Win95ja only] mouseEntered Event arbitrarily hides the window
- Closed