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

Click drag on JPopupMenu eventually generate ArrayIndexOutOfBoundsException

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 1.2.2
    • Fix Version/s: None
    • Component/s: client-libs

      Description



      Name: skT88420 Date: 06/11/99


      Click-drag to show the JPopupMenu and drag into the popup menu. Continue to hold down the mouse button and drag in and out of the menu. Eventually you will have the ArrayIndexOutOfBOundsException.
      Exception occurred during event dispatching:

      java.lang.ArrayIndexOutOfBoundsException

      at javax.swing.MenuSelectionManager.processMouseEvent(MenuSelectionManager.java:237)

      at javax.swing.plaf.basic.BasicPopupMenuUI$MouseGrabber.mouseDragged(BasicPopupMenuUI.java:311)

      at java.awt.Component.processMouseMotionEvent(Component.java:3190)

      at javax.swing.JComponent.processMouseMotionEvent(JComponent.java:1852)

      at java.awt.Component.processEvent(Component.java:2989)

      at java.awt.Container.processEvent(Container.java:991)

      at java.awt.Component.dispatchEventImpl(Component.java:2380)

      at java.awt.Container.dispatchEventImpl(Container.java:1036)

      at java.awt.Component.dispatchEvent(Component.java:2293)

      at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:2039)

      at java.awt.LightweightDispatcher.processMouseEvent(Container.java:1805)

      at java.awt.LightweightDispatcher.dispatchEvent(Container.java:1719)

      at java.awt.Container.dispatchEventImpl(Container.java:1023)

      at java.awt.Window.dispatchEventImpl(Window.java:749)

      at java.awt.Component.dispatchEvent(Component.java:2293)

      at java.awt.EventQueue.dispatchEvent(EventQueue.java:275)

      at java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java:96)

      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:87)

      at java.awt.EventDispatchThread.run(EventDispatchThread.java:78)


      No exception if click-release to bring up the JPopupMenu.


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


      public class JPopupAOOBBug extends JFrame {

        public JPopupAOOBBug() {
          super("JPopup Drag Bug");
          
          JLabel label = new JLabel("Popup Here");
          getContentPane().add(label);
          final JPopupMenu menu = new JPopupMenu();
          menu.add("Group1");
          menu.add("Group2");
          
          label.addMouseListener(new MouseAdapter() {
              public void mousePressed(MouseEvent event) {
                  menu.show(event.getComponent(), event.getX(), event.getY());
              }
          });


          
          setSize(300, 100);
          setVisible(true);
        }
        

        public static void main (String args[]) {
          JPopupAOOBBug frame = new JPopupAOOBBug();
          frame.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
              System.exit(0);
            }
          });
        }
        
          
        
      }
      (Review ID: 84265)
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              gsaab Georges Saab
              Reporter:
              skonchad Sandeep Konchady
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: