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

Odd beep in IE if multiple modal dialogs brought up

XMLWordPrintable

    • x86
    • windows_2000

      FULL PRODUCT VERSION :
      java version "1.6.0_12"
      Java(TM) SE Runtime Environment (build 1.6.0_12-b04)
      Java HotSpot(TM) Client VM (build 11.2-b01, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      MS Windows 2000 5.00.2195

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      Microsoft Internet Explorer 6.0.0.2800.1106

      A DESCRIPTION OF THE PROBLEM :
      We have some cases in our application where there are 2 consecutive modal dialogs are brought up. In IE, we have a beep happen every time the second dialog appears. Another thing that happens is that there is a 'flash' where the dialog appears to be focused/unfocused. This does not happen in Firefox and the Eclipse development environment.

      The problem seems to be related to some contention in focus between the modal dialog and the IE frame. This has occurred since the changes in 1.6.0_10

      We have many clients that still use Windows 2000 and IE 6 in their work place. They are in industries that are slow to update software technologies so updating OS and IE versions is not an option. We have been asked by one client to look at using our application under Java 1.6.0_12. Although this is an annoyance that will happen infrequently, it will be something that users will notice and cause frustration. We will be in a position to tell them that the issue that our software will work under Java 1.6.0_12 but there are several annoyances they can expect issues

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Showing the dialog should not beep and focus should be immediate, no contention of focus

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      package testing.dialogFocus;

      import java.awt.event.ActionEvent;
      import java.awt.event.ActionListener;
      import java.awt.event.FocusEvent;
      import java.awt.event.FocusListener;
      import java.awt.event.WindowEvent;
      import java.awt.*;

      import javax.swing.*;
      //applet for the test
      public class IdcTestDialogFocus extends JApplet implements
                          ActionListener {

        public IdcTestDialogFocus() {
          super();
        }

        public void init() {
          JPanel p = new JPanel();
          p.setLayout(new BorderLayout());
          JButton b = new JButton("test");
          b.setActionCommand("test");
          b.addActionListener(this);
          p.add(b, BorderLayout.NORTH);
          getContentPane().setLayout(new BorderLayout());
          getContentPane().add(p, BorderLayout.NORTH);
          enableEvents(WindowEvent.FOCUS_EVENT_MASK);
        }

        public void actionPerformed(ActionEvent e) {
          if (e.getActionCommand().equals("test")) {
            doTest();
          }
        }

        public void doTest() {
          Frame f = new JFrame();
          Component c = super.getParent();
          //we do this to get the base frame to ensure the dialog
          //does not get hidden by the IE frame
          while (c != null) {
            if (c instanceof Frame) {
              f = (Frame) c;
              break;
            }
            c = c.getParent();
          }

          IdcTestDialog dlg = new IdcTestDialog(f);
          //this dialog appears properly, no problem
          dlg.setVisible(true);
          dlg.setModal(false);

         //this dialog has a beep and associated flash
          dlg = new IdcTestDialog(f);
          dlg.setVisible(true);
        }

        public void processFocusEvent(FocusEvent e) {
          System.out.println("IdcTestDialogFocus.processFocusEvent = " + e);
        }
      }

      -----------------------------------------------------------


      package testing.dialogFocus;
      import javax.swing.*;

      import java.awt.*;
      import java.awt.event.ActionEvent;
      import java.awt.event.ActionListener;
      import java.awt.event.FocusEvent;
      import java.awt.event.WindowEvent;

      //this is the dialog used in the test
      public class IdcTestDialog extends JDialog implements ActionListener{
        public IdcTestDialog (Frame f) {
          super(f, true);
          setSize(100, 100);
          setLocation(300, 250);
          addContent();
          enableEvents(WindowEvent.FOCUS_EVENT_MASK);
        }

        public void addContent() {
          getContentPane().setLayout(new BorderLayout());
          JButton b = new JButton("close");
          b.setActionCommand("close");
          b.addActionListener(this);
          getContentPane().add(b, BorderLayout.SOUTH);
        }

        public void actionPerformed(ActionEvent e) {
          if (e.getActionCommand().equals("close")) {
            setVisible(false);
          }
        }
       
        public void processWindowEvent(java.awt.event.WindowEvent e) {
          //in IE, this code shows null 'opposite' values on the
          //WINDOW_ACTIVATED event. In the developer environment of
          //Eclipse, the opposite is the AppletViewer
          System.out.println("processWindowEvent: " + e);
        }
        public void processFocusEvent(FocusEvent e) {
          //in IE this line is printed. In the developer environment of Eclipse, there
          //is no output from this part of the code
          System.out.println("IdcTestDialog.processFocusEvent = " + e);
        }
      }

      ---------------------------------------
      //run this HTML code in the IE browser
      <HTML>
      <HEAD>
      <TITLE>Dialog Test</TITLE>
      </HEAD>
      <BODY TOPMARGIN=0 LEFTMARGIN=0 RIGHTMARGIN=0 BOTTOMMARGIN=0 >
      <OBJECT ID="DialogTest" NAME="DialogTest" CLASSID="clsid:CAFEEFAC-0016-0000-0012-ABCDEFFEDCBA" WIDTH="100" HEIGHT="100"><PARAM name="type" value="application/x-java-applet;jpi-version=1.6.0_12">
      <PARAM name="CODE" value="testing.dialogFocus.IdcTestDialogFocus" >
      </OBJECT>
      </BODY>
      </HTML>

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

      CUSTOMER SUBMITTED WORKAROUND :
      use firefox or a Java version less than 1.6.0_10

      Release Regression From : 6u10
      The above release value was the last known release where this
      bug was not reproducible. Since then there has been a regression.

            dtitov Daniil Titov (Inactive)
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: