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

With identical JInternalFrames, accelerator should activate menu in active frame

XMLWordPrintable

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



      Name: rk38400 Date: 05/04/98


      The following source creates two internal frames,
      each having the same menu -- including a File
      menu whose mnemonic is 'f'. Pressing 'Alt-F'
      always activates the File menu in the first
      JInternalFrame whether it is the active frame
      or the other one is. To support mouse-less
      operation, 'Alt-F' should activate the File
      menu in the JInternalFrame that has the focus.

      import com.sun.java.swing.*;

      public class Test extends JFrame
      {
         public Test()
         {
            super( "Mnem test" );

            setBounds( 0, 0, 500, 500 );

            JDesktopPane desktop = new JDesktopPane();
            getContentPane().add( "Center", desktop );

            JInternalFrame f1 = new JInternalFrame( "Frame 1" );
            JMenuBar mbar1 = new JMenuBar();
            f1.setMenuBar( mbar1 );
            JMenu filemenu1 = new JMenu( "File" );
            filemenu1.setMnemonic( 'f' );
            mbar1.add( filemenu1 );
            JMenuItem item1 = new JMenuItem( "Item" );
            filemenu1.add( item1 );
            f1.setBounds( 0, 0, 250, 500 );
            desktop.add( f1 );

            JInternalFrame f2 = new JInternalFrame( "Frame 2" );
            JMenuBar mbar2 = new JMenuBar();
            f2.setMenuBar( mbar2 );
            JMenu filemenu2 = new JMenu( "File" );
            filemenu2.setMnemonic( 'f' );
            mbar2.add( filemenu2 );
            JMenuItem item2 = new JMenuItem( "Item" );
            filemenu2.add( item2 );
            f2.setBounds( 250, 0, 250, 500 );
            desktop.add( f2 );

            setVisible( true );
         }

         public static void main( String args[] )
         {
            new Test();
         }
      }
      (Review ID: 29623)
      ======================================================================

            svioletsunw Scott Violet (Inactive)
            rkarsunw Ralph Kar (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: