-
Bug
-
Resolution: Fixed
-
P4
-
1.4.0, 6
-
b40
-
x86
-
linux, linux_redhat_6.1, linux_redhat_9.0
Non-Java applications can produce ascii versions of dead keys by typing
the dead key followed by the space key. For example, in a German xmodmap, dead-acute followed by space produces apostrophe. dead-circumflex followed
by space produces ascii circumflex.
The test case below can be used to see that this does not work in JDK1.4.2
with lightweight TextComponents (including Swing).
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class MySwingTest extends JApplet implements KeyListener, ActionListener {
JTextField jtf = null;
JTextArea jta = null;
public static void main(String[] args) {
JFrame frame = new JFrame("MySwingTest");
JPanel p = new JPanel();
MySwingTest applet = new MySwingTest();
applet.init();
p.add("Center", applet);
frame.getContentPane().add(p);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setSize(850, 200);
frame.setVisible(true);
applet.start();
}
public void init() {
JLabel jl = new JLabel("Enter characters");
jtf = new JTextField("Hello World", 20);
jtf.addKeyListener(this);
jtf.addActionListener(this);
jta = new JTextArea("Hello World", 4, 30);
jta.addKeyListener(this);
// the default layout manager for a JApplet is a BorderLayout
this.getContentPane().setLayout(new FlowLayout());
this.getContentPane().add(jl, FlowLayout.LEFT);
this.getContentPane().add(jtf, FlowLayout.CENTER);
this.getContentPane().add(jta, FlowLayout.RIGHT);
}
public void start() {
jtf.requestFocus();
}
public void keyPressed(KeyEvent evt)
{
printKey(evt);
}
public void keyTyped(KeyEvent evt)
{
printKey(evt);
}
public void keyReleased(KeyEvent evt)
{
printKey(evt);
System.out.print("\n");
}
public void actionPerformed(ActionEvent evt)
{
System.out.print("\n");
System.out.print("Action Event\n");
System.out.println(evt.toString());
System.out.print("\n");
}
protected void printKey(KeyEvent evt)
{
switch(evt.getID())
{
case KeyEvent.KEY_TYPED:
break;
case KeyEvent.KEY_PRESSED:
break;
case KeyEvent.KEY_RELEASED:
break;
default:
System.out.println("Other Event ");
return;
}
System.out.print("params= " + evt.paramString() + " \n" +
"KeyChar: " + evt.getKeyChar() + " = " + (int) evt.getKeyChar() +
" KeyCode: " + evt.getKeyCode() +
" Modifiers: " + evt.getModifiers());
if (evt.isActionKey())
System.out.print(" Action Key");
System.out.print("\n");
System.out.println("keyText= " + evt.getKeyText(evt.getKeyCode())
+ "\n");
}
}
###@###.### 11/2/04 09:55 GMT
the dead key followed by the space key. For example, in a German xmodmap, dead-acute followed by space produces apostrophe. dead-circumflex followed
by space produces ascii circumflex.
The test case below can be used to see that this does not work in JDK1.4.2
with lightweight TextComponents (including Swing).
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class MySwingTest extends JApplet implements KeyListener, ActionListener {
JTextField jtf = null;
JTextArea jta = null;
public static void main(String[] args) {
JFrame frame = new JFrame("MySwingTest");
JPanel p = new JPanel();
MySwingTest applet = new MySwingTest();
applet.init();
p.add("Center", applet);
frame.getContentPane().add(p);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setSize(850, 200);
frame.setVisible(true);
applet.start();
}
public void init() {
JLabel jl = new JLabel("Enter characters");
jtf = new JTextField("Hello World", 20);
jtf.addKeyListener(this);
jtf.addActionListener(this);
jta = new JTextArea("Hello World", 4, 30);
jta.addKeyListener(this);
// the default layout manager for a JApplet is a BorderLayout
this.getContentPane().setLayout(new FlowLayout());
this.getContentPane().add(jl, FlowLayout.LEFT);
this.getContentPane().add(jtf, FlowLayout.CENTER);
this.getContentPane().add(jta, FlowLayout.RIGHT);
}
public void start() {
jtf.requestFocus();
}
public void keyPressed(KeyEvent evt)
{
printKey(evt);
}
public void keyTyped(KeyEvent evt)
{
printKey(evt);
}
public void keyReleased(KeyEvent evt)
{
printKey(evt);
System.out.print("\n");
}
public void actionPerformed(ActionEvent evt)
{
System.out.print("\n");
System.out.print("Action Event\n");
System.out.println(evt.toString());
System.out.print("\n");
}
protected void printKey(KeyEvent evt)
{
switch(evt.getID())
{
case KeyEvent.KEY_TYPED:
break;
case KeyEvent.KEY_PRESSED:
break;
case KeyEvent.KEY_RELEASED:
break;
default:
System.out.println("Other Event ");
return;
}
System.out.print("params= " + evt.paramString() + " \n" +
"KeyChar: " + evt.getKeyChar() + " = " + (int) evt.getKeyChar() +
" KeyCode: " + evt.getKeyCode() +
" Modifiers: " + evt.getModifiers());
if (evt.isActionKey())
System.out.print(" Action Key");
System.out.print("\n");
System.out.println("keyText= " + evt.getKeyText(evt.getKeyCode())
+ "\n");
}
}
###@###.### 11/2/04 09:55 GMT
- duplicates
-
JDK-4765333 Italian dead keys on US Keyboard don't work with space key on Linux
- Closed
- relates to
-
JDK-4935357 Linux X cannot generate {}[] characters on Danish keyboards (remote display)
- Resolved
-
JDK-4707542 Can't type some multi-character sequences with Swedish keyboard on Linux
- Closed
-
JDK-4797332 A few problems with dead keys in Swing text components
- Closed
-
JDK-4799500 dead key pressed/released twice should produce non-dead character on Unix
- Closed
-
JDK-4360364 Cyrillic input isn't supported under JRE 1.2.2 & 1.3 for Linux
- Resolved
(1 relates to)