Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4138231

[Win95ja only] mouseEntered Event arbitrarily hides the window

XMLWordPrintable

    • generic
    • generic

      Java application window hides under all of other windows(native or java)
      due to 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){}
         >>}

            dmendenhsunw David Mendenhall (Inactive)
            sishidasunw Shoji Ishida (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: