JDK-4081671 : TextComponent does not allow to enter characters via Ctrl+Alt (Alt Gr)
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.1.3,1.1.4,1.1.5
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: solaris_2.5.1,windows_95,windows_nt
  • CPU: x86,sparc
  • Submitted: 1997-09-25
  • Updated: 1999-01-15
  • Resolved: 1999-01-15
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other Other
1.1.6Fixed 1.2.0 1.2beta3Fixed
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Description

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: |@#^{}[]��`\~

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: 1.1.6 1.2beta3 FIXED IN: 1.1.6 1.2beta3 INTEGRATED IN: 1.2beta3
14-06-2004

EVALUATION Found source of problem in awt_Component.cpp. Need to handle ALT_MASK in WindowsKeyToJavaChar.
11-06-2004

WORK AROUND Name: diC59631 Date: 09/25/97 Use a KeyAdapter to catch and consume all KeyTyped events for the characters which are not editable and insert them. ======================================================================
11-06-2004

PUBLIC COMMENTS Cannot enter characters via AltGr on Win32 systems.
10-06-2004