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

A JTextArea inside a heavyweight JPopupMenu can't get focus if outside of Frame

XMLWordPrintable

    • x86
    • windows_98, windows_xp

      Name: jk109818 Date: 04/29/2002


      FULL PRODUCT VERSION :
      java version "1.3.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
      Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)
      AND
      java version "1.4.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
      Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)

      FULL OPERATING SYSTEM VERSION :
      Windows XP professional. No service pack


      A DESCRIPTION OF THE PROBLEM :
      Create a JPopupMenu with a JTextArea inside.
      When the menu popup and a part of it is outside of the
      main window, the caret will not be show.

      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      /**
       * Test showing a bug whan popup menu is display outside of the java frame
       */
      class TestPopup extends JFrame
      {
         private JPopupMenu aPopup;
         TestPopup( )
         {

            aPopup = new JPopupMenu( );
            aPopup.setLightWeightPopupEnabled(false);
            JPanel aPane = new JPanel( new BorderLayout() );

            JTextArea aTextArea = new JTextArea( 5, 5 );
            aPane.add( aTextArea, BorderLayout.CENTER );

            aPopup.add( aPane );
            setSize( 500, 500 );
            aPopup.setPreferredSize( new Dimension( 100, 200 ) );
            getContentPane( ).addMouseListener( new MouseAdapter()
               {
                  public void mousePressed( MouseEvent e )
                  {
                     {
                        aPopup.show( getContentPane( ), e.getX(), e.getY() );
                     }
                  }
               } );
         }
      }

      ---------- END SOURCE ----------

      CUSTOMER WORKAROUND :
      Create a Popup window by extending JDialog and managing
      the lost/gain of focus.
      (Review ID: 145919)
      ======================================================================
      ###@###.### 11/3/04 14:07 GMT

            kizune Alexander Zuev
            jkimsunw Jeffrey Kim (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: