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

JPopupMenu not available

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 1.2.0
    • client-libs



      Name: ccC48265 Date: 12/29/97


      In java.awt.swing.JTextArea,
      JPopupMenu is not available.

      In the following program,
      I do right button click, e.isPopupTrigger
      becomes true (message shows in System.out)
      but the popup menu does not show.

      import com.sun.java.swing.*;
      import java.awt.*;
      import java.awt.event.*;

      class TestTextArea {
        public static void main(String[] args) {
          JFrame frame = new JFrame();
          Container pane = frame.getContentPane();
          pane.add( new MyTextArea() );
          frame.setSize(500, 300);
          frame.setVisible(true);
        }
      }
      class MyTextArea extends JTextArea {
        JPopupMenu pop;

        MyTextArea() {
          enableEvents( AWTEvent.MOUSE_EVENT_MASK );
          pop = new JPopupMenu();
          pop.add( new JMenuItem( "pop 1" ) );
          pop.add( new JMenuItem( "pop 2" ) );
        }
        protected void processMouseEvent( MouseEvent e ){
          if( e.isPopupTrigger() ){
            System.out.println( "right click, but popup menu does not show" );
            pop.show( e.getComponent(), e.getX(), e.getY() );
          }
          super.processMouseEvent( e );
        }
      }
      (Review ID: 22542)
      ====================================================================
      ###@###.### (Dec 29, 1997):
      Using JDK1.2beta3(A), I was able to reproduce this bug on both
      sol2.6 and win32.
      ======================================================================

            gsaab Georges Saab
            ccresswesunw Claudette Cresswell (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: