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

JPopupMenu & JComboBox hang due to an unexpected exception

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 1.4.0
    • 1.4.0
    • client-libs
    • beta
    • x86, sparc
    • generic, solaris, solaris_8, windows_2000
    • Verified

      Run the following code and click the label to create a popup-menu. For the first time, nothing will happen; Repeat it once again, then an unexpected exception occurs and a core dump is generated. This is found happening in SunOS5.7, Solaris 8.0 and SolarisX86 8.0.
      A similar problem found in JComboBox popup, obviously.

      Code snippet:
      import java.awt.*;
      import java.awt.event.*;
      import javax.swing.*;

      public class FrameDemo extends JFrame {
          public FrameDemo() {
      setSize(300, 300);
              addWindowListener(new WindowAdapter() {
                  public void windowClosing(WindowEvent e) {
                      System.exit(0);
                  }
              });
              
              //adding JPasswordField
              final JLabel label = new JLabel("Right-click herefor popup");
              final JPopupMenu pMenu = new JPopupMenu();
              pMenu.add("FirstMenu");
              label.addMouseListener(new MouseAdapter(){
                public void mousePressed(MouseEvent e) {
                  pMenu.show(label, e.getX(), e.getY());
                }
              });
              
              getContentPane().add(label, BorderLayout.CENTER);
          }
          public static void main(String s[]) {
            FrameDemo fd = new FrameDemo();
            fd.pack();
            fd.setVisible(true);
          }
      }

      Exception seen on console:
      # # An unexpected exception has been detected in native code outside the VM.# Program counter=0xf5e4d488
      #
      # Problematic Thread: prio=5 tid=0x1167e0 nid=0xc runnable
      #
      Abort (core dumped)

            hgajewsksunw Hania Gajewska (Inactive)
            sramansunw Sridhar Raman (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: