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

Modal dialog hidden when tooltip shown

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 6u12
    • client-libs
    • x86
    • windows_xp

      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 :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      If a modal dialog is created from a popup whose context is an Applet, and that dialog has a component with a tooltip, the dialog gets hidden when the tooltip displays. Clicking brings the dialog back.

      This happens in 1.6.0_10 and 1.6.0_12.

      This only happens when using a signed Applet. Attached is the complete folder. You just need to run HiddenTooltipApplet.htm then follow the instructions in the bug report. To re-build just run ant.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1) Compile the class and create a signed JAR (build.xml and HTML file available by email)
      2) Load the applet from the signed JAR via HTML into a browser
      3) Click and hold on the applet background
      4) Select the item from the popup
      5) Move the mouse over the label in the resulting dialog
      6) When the tooltip appears, the dialog is hidden behind the main window


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
        Tooltip should be seen
      ACTUAL -
      Browser is displayed over the dialog - clicking brings it back

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      package bug;

      import javax.swing.*;
      import java.awt.*;
      import java.awt.event.*;

      /**
       * Test case for bug in 6.0u12
       * @author Mick Francis, Deltascheme Ltd. 2009-02-09
       *
       * To reproduce the bug:
       * 1) Compile the class and create a signed JAR
       * 2) Load the applet from the signed JAR via HTML into a browser
       * 3) Click and hold on the applet background
       * 4) Select the item from the popup
       * 5) Move the mouse over the label in the resulting dialog
       * 6) When the tooltip appears, the dialog is hidden behind the main window
       */
      public class HiddenTooltipApplet extends JApplet {

          public void start() {
              SwingUtilities.invokeLater(new Runnable() {
                      public void run() {
                          final JApplet app = HiddenTooltipApplet.this;
                          final JPopupMenu pu = new JPopupMenu("Popup");
                          pu.add(new AbstractAction("Show dialog") {
                                  public void actionPerformed(ActionEvent e) {
                                      Frame frame = (Frame)SwingUtilities.getAncestorOfClass(Frame.class, app);
                                      JDialog dialog = new JDialog(frame, "Test dialog", true);
                                      JLabel label = new JLabel("Label");

                                      dialog.setMinimumSize(new Dimension(200,200));
                                      dialog.setLocation(app.getLocationOnScreen());
                          
                                      label.setToolTipText("This is some long tooltip text to demonstrate the bug. This is some long tooltip text to demonstrate the bug. This is some long tooltip text to demonstrate the bug");

                                      dialog.add(label);
                                      dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

                                      dialog.pack();
                                      dialog.setVisible(true);
                                  }});

                          getContentPane().addMouseListener(new MouseAdapter() {
                                  public void mousePressed(MouseEvent evt) {
                                      pu.show(app, evt.getX(), evt.getY());
                                  }});
                      }
                  });
          }
      }


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

      CUSTOMER SUBMITTED WORKAROUND :
      Use the Applet's ContentPane rather than the Applet itself as the invoker parameter to JPopupMenu.show()

            Unassigned Unassigned
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: