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

PopupMenu not showing up

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 1.4.0
    • 1.4.0
    • client-libs
    • beta
    • x86
    • generic
    • Verified

      I am trying to bring a JPopupMenu over an AWT(Label) component, with setDefaultLightWeightPopupEnabled(false). It works in jdk1.2, 1.3 but not in the latest merlin build.

      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);
                  }
              });
              JPopupMenu.setDefaultLightWeightPopupEnabled(false);
              final Label label = new Label("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);
          }
      }

            svioletsunw Scott Violet (Inactive)
            sramansunw Sridhar Raman (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: