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

Popup menus don't work with the java.awt.Frame class if a menubar is

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 1.1, 1.1.1, 1.1.2
    • client-libs
    • None
    • x86
    • windows_nt



      Name: sg39081 Date: 08/18/97


      The example listed below demonstrates the problem. PopupMenus do work on
      NT as long as you don't add a MenuBar to the window. I am using jdk 1.1.1
      on a Windows NT 4.0 platform. They work fine on Solaris. The proper functioning
      of these components is critical to the success of my application.

      import java.awt.*;
      import java.awt.event.*;

      public class PopupMenuTest extends Frame
      {
         PopupMenu pm;

         public static void main(String args[])
         {
            new PopupMenuTest();
         }

         public PopupMenuTest()
         {
            super( "PopupMenu Test" );

            MenuBar menuBar = new MenuBar();
            setMenuBar( menuBar );

            Menu file = new Menu( "File" );
            menuBar.add( file );
            Menu edit = new Menu( "Edit" );
            menuBar.add( edit );

            pm = new PopupMenu();
            MenuItem copy = new MenuItem( "Copy" );
            MenuItem cut = new MenuItem( "Cut" );
            MenuItem paste = new MenuItem( "Paste" );
            pm.add( copy );
            pm.add( cut );
            pm.add( paste );
            add( pm );

            enableEvents(AWTEvent.MOUSE_EVENT_MASK);

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

         public void processMouseEvent(MouseEvent e)
         {
            if ( e.isPopupTrigger() )
            {
               pm.show(this, e.getX(), e.getY());
            }

            super.processMouseEvent(e);
         }
      }

      -- Shoaib

      company - Daleen Technologies, Inc. , email - ###@###.###
      ======================================================================

            cchongsunw Creighton Chong (Inactive)
            sgoodsunw Sheri Good (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: