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

TextComponent does not allow to enter characters via Ctrl+Alt (Alt Gr)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.2.0
    • 1.1.3, 1.1.4, 1.1.5
    • client-libs
    • None
    • 1.2beta3
    • x86, sparc
    • solaris_2.5.1, windows_95, windows_nt
    • Not verified



        Name: diC59631 Date: 09/25/97


        In 1.1.4's TextComponents TextArea and TextField it is not possible to enter any characters which are the third character on a key (entered via Ctrl+Alt or AltGr). It is possible to enter these characters via Alt+Keycode on numeric keypad.
        The correct KeyTyped event is generated, but the character is not inserted and the 'wrong key'-sound is heard.
        On german keyboards some importent characters like "\|{[]}~" are the third character of a key - and so can not be used with jre1.1.4!

        Here is my testprogram:

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

        class ShowKey extends Frame {
            static public void main(String args[]) {
                ShowKey showKey = new ShowKey();
            }

            ShowKey() {
                addWindowListener(new WAdapter());
                TextField tf = new TextField();
                add(tf);
                tf.addKeyListener(new MyKeyAdapter());
                pack();
                show();
            }

            class WAdapter extends WindowAdapter {
                public void windowClosing(WindowEvent event) {
                    System.exit(0);
                }
            }

            class MyKeyAdapter extends KeyAdapter {
                public void keyPressed(KeyEvent e) {
                    System.out.println(e);
                }
                public void keyReleased(KeyEvent e) {
                    System.out.println(e);
                }
                public void keyTyped(KeyEvent e) {
                    System.out.println(e);
                }
            }
        }

        Starting and pressing "Alt Gr"+"\" produces following output (the "\" does not appear in the TextField but the 'wrong-key'-sound is heard):

        java.awt.event.KeyEvent[KEY_PRESSED,keyCode=17,keyChar=' ',modifiers=Ctrl+Alt] on textfield0
        java.awt.event.KeyEvent[KEY_PRESSED,keyCode=18,keyChar=' ',modifiers=Ctrl+Alt] on textfield0
        java.awt.event.KeyEvent[KEY_PRESSED,keyCode=219,keyChar='\',modifiers=Ctrl+Alt] on textfield0
        java.awt.event.KeyEvent[KEY_TYPED,keyCode=0,keyChar='\',modifiers=Ctrl+Alt] on textfield0
        java.awt.event.KeyEvent[KEY_RELEASED,keyCode=219,keyChar='\',modifiers=Ctrl+Alt] on textfield0
        java.awt.event.KeyEvent[KEY_RELEASED,keyCode=17,keyChar=' '] on textfield0
        java.awt.event.KeyEvent[KEY_RELEASED,keyCode=18,keyChar=' '] on textfield0

        ======================================================================
        Another report:

        Java TextFields and TextAreas don't accept
        special characters like '|', '@', '~', '^'
        (in combination with ALT-CTRL) any more.

        for example, I'm typing 'ALT-CTRL-+' (to get '~' on a German keyboard) or 'ALT-CTRL-7' (to get '{').

        brian.klock@eng 1997-11-07
        ======================================================================

        mircea.oancea@canada 1998-05-15
        Belgian AZERTY keyboard, type data in any Text field.
        Problem appears on JDK 1.1.4 - JDK 1.1.5, on NT4 as well as Win95, and
        was absent on all previous JDK releases (1.02 through 1.1.3).
        Sample characters are: |@#^{}[]´`\~

              cchongsunw Creighton Chong (Inactive)
              dindrigo Daniel Indrigo (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: