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

1.4 REGRESSION: JMenu disappears if opening a modal dialog with JMenuItem

XMLWordPrintable

    • b25
    • x86
    • linux_redhat_8.0, windows_2000, windows_xp



      Name: jk109818 Date: 08/22/2003


      FULL PRODUCT VERSION :
      java version "1.4.2"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28)
      Java HotSpot(TM) Client VM (build 1.4.2-b28, mixed mode)

      FULL OS VERSION :
      Microsoft Windows 2000 [Version 5.00.2195]

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      Service Pack 3

      A DESCRIPTION OF THE PROBLEM :
      Our app is a JFrame with a JMenuBar added.
      The action listener of the menu items opens modal dialogs.
      The menu does not work properly if we try to open a dialog the second time.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      do the following with the mouse:
      * open dialog using the menu entry (first time behaves properly!)
      * close dialog
      * click on the JMenu
      * move the mouse down (try open the dialog)

      Mouse pointer must not leave main frame between this steps.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      want to use menu popup

      ACTUAL -
      the menu popup vanish

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.*;
      import java.awt.event.*;
      import javax.swing.*;
      public class menutest extends JFrame {
        public static void main(String[] args) throws Exception {
          new menutest();
        }
        public menutest() throws Exception {
          this.setJMenuBar(new MainMenu(this));
          this.setSize(new Dimension(150, 80));
          this.setVisible(true);
        }
      }
      class MainMenu extends JMenuBar
      {
        JFrame frame;
        JMenu menu = new JMenu();
        JMenuItem miOpen = new JMenuItem();
        JMenuItem miExit = new JMenuItem();
        public MainMenu(JFrame frame)
        {
          this.frame = frame;
          miOpen.setText("open");
          miOpen.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              openDialog();
            }
          });
          miExit.setText("exit");
          miExit.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              System.exit(0);
            }
          });
          this.add(menu);
          menu.setText("file");
          menu.add(miOpen);
          menu.add(miExit);
        }
        void openDialog() {
          JDialog dlg = new JDialog(frame,true);
          dlg.setLocation(10, 10);
          dlg.setVisible(true);
        }
      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      the user has to move up the mouse again

      Release Regression From : 1.3.1_08
      The above release value was the last known release where this
      bug was known to work. Since then there has been a regression.

      (Incident Review ID: 199855)
      ======================================================================

            kizune Alexander Zuev
            jkimsunw Jeffrey Kim (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: