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

Mnemonic character appear in JTextComponents

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P3 P3
    • None
    • 1.2.1, 1.2.2
    • client-libs
    • x86
    • windows_95, windows_nt



      Name: vi73552 Date: 06/23/99


      If a JTextField or JTextArea has focus when
      you hit the key combination for a mnemonic
      the letter you press is added to the content
      of the JTextField or JTextArea.

      This means that, for example, you can't save a record
      without adding an 's' to whatever field you are in when
      you press alt-S!

      Here is my example code:

      import javax.swing.*;

      class MnemonicTest extends JFrame{

      public MnemonicTest(){

      JButton button = new JButton("Test");
      button.setMnemonic( 'T' );

      getContentPane().add( new JTextField(), "North" );

      getContentPane().add(new JLabel("Cursor in box and press Alt+T!") );

      getContentPane().add(button, "South");
      setBounds(30,30,100,100);
      show();

      }

      public static void main(String args[]){
      new MnemonicTest();
      }
      } // end class

      This bug has been reported before (4127028) and then closed
      because it was not reproducible.

      I believe that this is because it wasn't stipulated that the
      JTextComponent should have focus when the key combination is
      pressed or perhaps it doesn't occur on Solaris.

      This bug effectively makes mnemonics useless for most
      applications and needs to be fixed urgently.
      (Review ID: 84726)
      ======================================================================

            tprinzing Tim Prinzing (Inactive)
            vasya Vassili Igouchkine (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: