JDK-4627542 : Swing applications don't support international keyboards under Linux
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.3.1,1.4.0
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux
  • CPU: x86
  • Submitted: 2002-01-23
  • Updated: 2002-04-25
  • Resolved: 2002-04-25
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
1.4.1 hopperFixed
Related Reports
Relates :  
Relates :  
Description

Name: jk109818			Date: 01/23/2002


FULL PRODUCT VERSION :
java version "1.4.0-rc"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-rc-b91)
Java HotSpot(TM) Client VM (build 1.4.0-rc-b91, mixed mode)

FULL OPERATING SYSTEM VERSION :Linux 2.4.2-2 i686


ADDITIONAL OPERATING SYSTEMS :NONE



EXTRA RELEVANT SYSTEM CONFIGURATION :
I use an internation keyboard (French Canadian keyboard)
supported by XFree86. I suspect the problem is the same with
any international keyboard.

XFree86 currently in use: 4.0.3-5 (Linux RedHat 7.1)

A DESCRIPTION OF THE PROBLEM :
With the French Canadian keyboard, we can't generate keys
such as [, ], { which are usually generated by typing
"altcar" (right alt) with a dead key (appearing as `,[, ]
under a us keyboard).

This works with AWT applications, it only fails with Swing
applications.

This effectively makes non-English Swing applications under
Linux impossible.

This is the same bug as

http://developer.java.sun.com/developer/bugParade/bugs/4371923.html

but I've worked hard to add more useful info.

Note the the bug is misclassified under AWT when it is a
Swing bug! Note also that it doesn't matter whether it is a
German or French or French Canadian keyboard, so you should
say "internation keyboard" instead.

Note that I give precise steps to reproduce the problems,
even with a us keyboard and without knowing anything about
non-us keyboards!!!

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. setxkbmap ca_enhanced
2. Holding the right alt down and pressing [, you should see
"[" appear. Pressing [ alone does nothing. Pressing [
followed by "space" returns ^ ([ acts as a dead key).

You can verify that this works for all AWT apps and all
Linux apps.

3.Install JDK 1.4 rc
4.cd /usr/java/j2sdk1.4.0/demo/jfc/Notepad
5. /usr/java/j2sdk1.4.0/bin/java -jar Notepad.jar

6. Try typing "right-alt" and "[", you will noticed that
nothing happens.
At this point, Notepad opens but you can't generate [,], {
if you set the keyboard to French Canadian

EXPECTED VERSUS ACTUAL BEHAVIOR :
During step 6., I expect "[" to come up in the text pane of
Notepad.

ERROR MESSAGES/STACK TRACES THAT OCCUR :
I'm not sure they are relevant, but here's what appears when I launch a Swing app.

Warning: Cannot convert string "<Key>Escape,_Key_Cancel" to type VirtualBinding
Warning: Cannot convert string "<Key>Home,_Key_Begin" to type VirtualBinding
Warning: Cannot convert string "<Key>F1,_Key_Help" to type VirtualBinding
Warning: Cannot convert string "Shift<Key>F10,_Key_Menu" to type VirtualBinding
Warning: Cannot convert string "<Key>F10,Shift_Key_Menu" to type VirtualBinding
Warning: Cannot convert string "<Key>KP_Enter,_Key_Execute" to type VirtualBinding
Warning: Cannot convert string "Alt<Key>Return,Alt_Key_KP_Enter" to type
VirtualBinding

This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import javax.swing.*;

public class SwingTest {
  public static void main( String[] args ) {
    JFrame f = new JFrame();
    f.getContentPane().add( new JTextField( 40 ) );
    f.pack();
    f.show();
  }
}


---------- END SOURCE ----------

CUSTOMER WORKAROUND :
Switch temporarily to a US keyboard (by typing 'setxkbmap
us', for example - and 'setxkbmap ca' to come back to French
for instance.

Unfortunately, this effectively deactivate the international
keyboard and makes typing in non-English languages very
difficult (can't generate accents such as ��, ��, ...).
(Review ID: 138669) 
======================================================================

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

EVALUATION This is likely because we don't have API to determine when a KeyTyped event contains a valid character (4435010). I have contacted submitter for more information to make sure this is in fact happening. ###@###.### 2002-01-23 Actually, I think this is a duplicate of 4379138, not 4371923. There are a couple of other bugs which are probably related. ###@###.### 2002-01-24 I asked submitter to run test case which dumps ooutput from KeyListener attached to light weight components. Here is the output (notice the lack of key typed events): Ok. I click on altchar-"[" which should generate "[". Focus on one of the red box (far left): pressed code = 65406 char = '?' (int)char = 65535 modifiers = 32 pressed code = 130 char = '?' (int)char = 65535 modifiers = 0 released code = 130 char = '?' (int)char = 65535 modifiers = 0 released code = 65406 char = '?' (int)char = 65535 modifiers = 32 Focus on textfield on the far right: (nothing happening) Focus on the textfield right next to second red box: (this textfield works): pressed code = 65406 char = '?' (int)char = 65535 modifiers = 32 pressed code = 130 char = '?' (int)char = 65535 modifiers = 0 released code = 130 char = '?' (int)char = 65535 modifiers = 0 released code = 65406 char = '?' (int)char = 65535 modifiers = 32 ================ TEST 2 ================ Next, I click on altchar-] which should generate "]". Focus on one of the red box (far left): pressed code = 65406 char = '?' (int)char = 65535 modifiers = 32 pressed code = 139 char = '?' (int)char = 65535 modifiers = 0 released code = 139 char = '?' (int)char = 65535 modifiers = 0 released code = 65406 char = '?' (int)char = 65535 modifiers = 32 Focus on textfield on the far right: (nothing happening) Focus on the textfield right next to second red box: (this textfield works): pressed code = 65406 char = '?' (int)char = 65535 modifiers = 32 pressed code = 139 char = '?' (int)char = 65535 modifiers = 0 released code = 65406 char = '?' (int)char = 65535 modifiers = 32 ================ TEST 3 ================ Next, I click on altchar-` which should generate "{". Focus on one of the red box (far left): pressed code = 65406 char = '?' (int)char = 65535 modifiers = 32 pressed code = 130 char = '?' (int)char = 65535 modifiers = 0 released code = 130 char = '?' (int)char = 65535 modifiers = 0 released code = 65406 char = '?' (int)char = 65535 modifiers = 32 Focus on textfield on the far right: (nothing happening) Focus on the textfield right next to second red box: (this textfield works): pressed code = 65406 char = '?' (int)char = 65535 modifiers = 32 pressed code = 128 char = '?' (int)char = 65535 modifiers = 0 released code = 128 char = '?' (int)char = 65535 modifiers = 0 released code = 65406 char = '?' (int)char = 65535 modifiers = 32 Look into the comments section for information on the users machine setup. ###@###.### 2002-01-24 The VirtualBinding warnings are probably caused by a motif bug: 4317815. The fix went into solaris patch 107081-30 (sparc) and 107082-30 (x86). I don't know how this will be addressed for Linux, since I'm not entirely sure how motif is distributed for Linux. ###@###.### 2002-01-24 Note: we maintain our own motif libraries, and statically link to them for the linux version of our jdk. For 1.4.1, we updated our linux workspace with the latest Sun motif workspace for solaris, so the VirtualBinding warnings should disappear in 1.4.1. ###@###.### 2002-04-02 Since a French Canadian keyboard is necessary to verify this fix, it will not be necessary for SQE to verify this bug. ###@###.### 2002-04-17
02-04-2002