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

Cascading popups broken in 1.6

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b15
    • CPU:
      x86
    • OS:
      windows_xp
    • Verification:
      Verified

      Backports

        Description

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

        ADDITIONAL OS VERSION INFORMATION :
        Microsoft Windows XP [Version 5.1.2600]

        A DESCRIPTION OF THE PROBLEM :
        In java 1.5.0_09 when one popup is open and contains a button that triggers a second sub popup, when the second popup was triggered the first one remains open.
        In 1.6.0 however opening the second popup results in the first one being removed.

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Compile an run the following code with both 1.5 and 1.6 JREs.

        Click on the main button, the first popup will appear.
        Click on the button in the first popup.


        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        Expected both popups to be visible after clicking on the button in the first poup.
        ACTUAL -
        When the second popup is opened, the first one is removed. This appears to be a regression from the 1.5 behaviour.

        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        import java.awt.MouseInfo;
        import java.awt.event.ActionEvent;
        import java.awt.event.ActionListener;

        import javax.swing.BoxLayout;
        import javax.swing.JButton;
        import javax.swing.JComboBox;
        import javax.swing.JFrame;
        import javax.swing.JLabel;
        import javax.swing.JPopupMenu;

        public class CascadingPopups extends JFrame {

            private JPopupMenu popup = null;

            JComboBox dropDown = null;

            private JPopupMenu popup2;

            private JButton popup1Button;

            private JButton mainButton;

            public CascadingPopups() {

                // Create and set up the window.
                this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                this.setBounds(100, 100, 640, 480);
                mainButton = new JButton("Button");
                this.getContentPane().add(mainButton);

                // create the popups
                popup = new JPopupMenu();
                popup.setLayout(new BoxLayout(popup, BoxLayout.Y_AXIS));
                popup.add(new JLabel("Popup 1"));
                popup1Button = new JButton("Button");
                popup.add(popup1Button);

                popup2 = new JPopupMenu();
                popup2.add(new JLabel("Popup 2"));

                mainButton.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        popup.setLocation(MouseInfo.getPointerInfo().getLocation().x,
                                MouseInfo.getPointerInfo().getLocation().y);
                        popup.setVisible(true);
                    }
                });
                
                popup1Button.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        popup2.setInvoker(popup1Button);
                        popup2.setLocation(MouseInfo.getPointerInfo().getLocation().x,
                                MouseInfo.getPointerInfo().getLocation().y);
                        popup2.setVisible(true);
                    }
                });
                
                // Display the window.
                this.validate();
                this.setVisible(true);
            }

            public static void main(String[] args) {

                javax.swing.SwingUtilities.invokeLater(new Runnable() {
                    public void run() {
                        new CascadingPopups();
                    }
                });
            }
        }

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

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

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                alexp Alexander Potochkin (Inactive)
                Reporter:
                ndcosta Nelson Dcosta (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: