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

Closing a window by a lightweight menu causes error.

XMLWordPrintable

    • 1.2.2
    • generic, x86, sparc
    • generic, solaris_2.5.1, solaris_2.6, solaris_8, windows_nt



      Name: jtC48319 Date: 06/08/98


      I was finally able to isolate two errors I filed
      previous bug reports on but couldn't isolate then.
      When I run this application in the foreground:
      import java.awt.*;
      import java.awt.event.*;
      import java.awt.swing.*;

      public class BugFrame extends JFrame implements ActionListener
      {
        private JMenuItem quitButton;

        public static void main(String args[])
        {
          BugFrame test = new BugFrame();
          test.show();
        }

        public BugFrame()
        {
          JMenuBar mBar = new JMenuBar();
          setJMenuBar( mBar );
          JMenu fileMenu = new JMenu( "File" );
          mBar.add( fileMenu );
          quitButton = new JMenuItem( "Close" );
          fileMenu.add( quitButton );
          quitButton.addActionListener(this);
          JPanel p = new JPanel();
          p.setPreferredSize(new Dimension(100, 100));
          getContentPane().add(p);
          pack();

        }

        public void actionPerformed(ActionEvent ev)
        {
          Object obj = ev.getSource();
          if (obj == quitButton) {
      setVisible(false);
          }
        }


      }

      and press the "Close" menu entry, the window closes
      and this error message is generated:
      Received a mouse event from a non-showing Component java.awt.swing.JMenu[,0,1,45x19,layout=java.awt.swing.OverlayLayout, JMenu]
      Received a mouse event from a non-showing Component java.awt.swing.JMenu[,0,1,45x19,layout=java.awt.swing.OverlayLayout, JMenu]

      (You'll have to kill the process since it doesn't
      exit on close).

      The same error is generated if you dispose of the
      window instead of setting visibility to false.

      If I instead run this in the background, the
      application hangs with the window still showing
      and when I hit return in the xterm it was invoked
      from, I get this:
      2] + Suspended (tty output) /local/applications/Java/INSTALLED/jdk1.2beta3/bin/java BugFrame

      I then have to kill the java process.
      (Review ID: 33174)
      ======================================================================

            gsaab Georges Saab
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: