JDK-6703772 : Regression: JPasswordField doesn't always recognize AltGraph Keystrokes in Java SE 6
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt:i18n
  • Affected Version: 6
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic,linux
  • CPU: generic,x86
  • Submitted: 2008-05-16
  • Updated: 2010-08-04
  • Resolved: 2009-02-06
Related Reports
Duplicate :  
Duplicate :  
Description
A JPasswordField doesn't always recognize AltGraph Keystrokes in Java SE 6. A reproducible testcase is available (it is attached to this CR).

In order to enter special characters, you sometimes need the AltGraph key. Actually that need depends on the keyboard layout you use in your country. In order to enter the at-character ('@') on a german keyboard for example, you need to hit both the AltGraph-Key and the q-Key while on an US keyboard it is enough to use both the shift-key and the 2-key. So in order to reproduce the problem, go and find a localized keyboard first :-D

Testcase:
Run the attached GUI by entering
java -jar PasswdTest.jar

As the testcase has been created with Netbeans 6, you need the libs in the lib folder which has also been provided.

At the GUI you see an editable password text field, a button to transfer the content of the password text field to the two other non-editable text fields below and the Java Version which you are currently using. If you release a key at the password text field, the other two non-editable textfields will be filled with the current content of the password text field. You can force the action also by the button called "Get text".

In the password text field called "Password:" enter "genius@work" for example. Note that you need to enter it manually, character by character and you need to enter it on a keyboard where you need to use the AlgGraph key in order to enter the @-character. If you are on an US keyboard you won't be able to reproduce the problem, because on an US-keyboard you don't need the AltGraph key in order to enter the @-character.
Once you have entered the '@' character you will notice that the 'q' appears rather than the '@' character. You get "geniusqwork" rather than "genius@work".

Note that there is no problem if you copy/paste characters from other applications to the JPasswordField rather than entering them manually with the keyboard.

Comments
EVALUATION Re-evaluation has been requested, see comments.
04-06-2008

EVALUATION According to the JPasswordField spec in jdk6, "NOTE: By default, JPasswordField disables input methods; otherwise, input characters could be visible while they were composed using input methods. If an application needs the input methods support, please use the inherited method, enableInputMethods(true)."
04-06-2008

EVALUATION Assigned to AWT pals to have their opinion, note that this bug and its duplicate #6699860 both complains of JPasswordField
03-06-2008

WORK AROUND Copy the problematic characters into the clipboard and paste them into the JPasswordField rather than entering them manually. Due to security reasons, don't copy the entire, unprotected password to the clipboard.
16-05-2008