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

Self-mouseEntered program causes Windows exception.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P4
    • None
    • 1.1.6
    • client-libs
    • x86
    • windows_95

    Description



      Name: paC48320 Date: 05/11/98


      Java program that triggers mouseEntered() and mouseExited() method invocation
      by its setVisible() and setBounds() invocation causes Windows exception.
      This does not occur in Solaris environment.
       
      Following instruction and code demonstrates the problem.
       
      1.Run the java program.
        e:\test java TestW
      2.Move the mouse to the center of the window, i.e. within the black box.
      3.Windows error dialog will be displayed.
       
      In Windows 95, sometimes the machine itself crushes. In Windows 98,
      it always causes machine crush rather than a windows error dialog.
       
      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: 30054)
      ======================================================================

      Attachments

        Issue Links

          Activity

            People

              rkhansunw Robi Khan (Inactive)
              pallenba Peter Allenbach (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: