JDK-4128471 : JTextComponent does not allow to enter characters via Ctrl+Alt (Alt Gr)
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.1.5,1.1.6,1.2.0
  • Priority: P1
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_95,windows_nt
  • CPU: generic,x86
  • Submitted: 1998-04-13
  • Updated: 1998-09-17
  • Resolved: 1998-09-17
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Description

Name: rk38400			Date: 04/13/98


Swing 1.0 :
The JTextComponent's derived objects does not allow entering of ^@`|{~ on european keyboards.
All these chars needs Alt-Gr pressed.

To test, simply create one JTextField, and try, on a french keyboard, to enter \ (Alt-Gr 8).
(Review ID: 26550)
======================================================================

From a duplicate bug report:



Name: rk38400			Date: 05/19/98


The following test program starts a window which
contains a JTextPane and an awt TextField.
Try to enter curly braces { and } into the 
TextField and JTextPane, they show up in the awt
TextField for JDK 116 or JDK1.2beta3, but not in
JTextPane for JDK116+Swing1.0.1 or Swing1.0.2.

You may try this on with a swedish keyboard, 
or with an English keyboard by doing:
1. add the Swedish (or Swedish(Finland)) keyboard
to your keyboard list using Windows' control panel.
2. Switch between English and other keyboards by
pressing the leftAlt+Shift
3. once you are on Swedish (or Swedich Finland) 
keyboard, rightAlt+7 is the { (left brace) and
rightAlt+0(zero) is the } (right brace).

Here is the testing program:

//import com.sun.java.swing.*;
import java.awt.swing.*;
import java.awt.TextField;
import java.awt.BorderLayout;
public class TestTextPane {
    public static void main(String args[]) {
	JPanel pane = new JPanel(new BorderLayout());
	JTextPane textPane = new JTextPane();
	textPane.setText("Try to type the letters you have problem with here.");
	JScrollPane scroller = new JScrollPane();
	scroller.getViewport().add(textPane);
	JFrame f = new JFrame();
	pane.add(scroller);
	pane.add(new TextField(), "South");
	f.getContentPane().add(pane);
	f.setSize(200, 150);
	f.show();
    }
}
(Review ID: 30711)
======================================================================

brian.beck@Eng 1998-06-01

Comments
WORK AROUND Name: rk38400 Date: 04/13/98 One workaround is to bypass completely all the Swing Keymaps, for example, if we have a textfield named jTextField1, these lines allow it to support extended caracteres : jTextField1.addKeyListener (new KeyAdapter () { public void keyTyped (KeyEvent evt) { jTextField1.replaceSelection (String.valueOf(evt.getKeyChar ())); evt.consume (); } }); But i'm not very pleased with this. ======================================================================
11-06-2004

EVALUATION Using the test program from the related bug I've verified that AWT Text fields are correctly inputing ALT-GR sequences while JTextPanes are not. I tested against the 1.2beta4-H build. brian.beck@Eng 1998-06-02
02-06-1998