Keywords
java, solaris, jdk, keycode, keyevent, numpad, numlock,
keypressed danish keyboard, swedish keyboard
Product java/solaris/classes_awt DANISH / SWEDISH KEYBOARD!!!!!!!!!!!!!!!!!!!!!!
On Solaris, the decimal point key on the numpad (KeyChar=,
KeyCode=110 KeyText=NUM .)
does not generate any key
events(KeyPressed/KeyReleased/KeyTyped).
Note that the "," character is actually displayed in the
text field
despite the fact that no event has been generated!
This has been verified on Solaris Sparc and Solaris Intel
with all available versions of jdk 1.1.x, jdk 1.2.x
on DANISH/SWEDISH keyboards.
Here is the sample code to reproduce the problem:
The file Key.html:
---------------------------------- Cut Here
----------------------------------
<html>
<head>
<title>The NumPad Test Applet</title>
</head>
<body>
<p>
<applet code="Key.class" width=500 height=300>
</applet>
</body>
</html>
---------------------------------- Cut Here
----------------------------------
The file Key.java:
---------------------------------- Cut Here
----------------------------------
import java.applet.*;
import java.lang.*;
import java.awt.*;
import java.awt.event.*;
public class Key extends Applet {
private TextField tf;
public void init() {
this.setLayout(new
FlowLayout(FlowLayout.CENTER, 30, 30));
tf = new TextField("ABCD",20);
this.add(tf);
tf.addKeyListener(
new KeyListener() {
public void keyTyped(KeyEvent e) {
System.out.print( "KeyTyped: ");
printKeyInfo(e);
}
public void keyReleased(KeyEvent e) {
System.out.print( "KeyReleased: ");
printKeyInfo(e);
System.out.println("----------------");
}
public void keyPressed(KeyEvent e) {
System.out.print( "KeyPressed: ");
printKeyInfo(e);
}
} );
tf.addActionListener(
new ActionListener() {
public void actionPerformed( ActionEvent e
) {
System.out.println( e );
}
} );
}
public void printKeyInfo(KeyEvent e) {
System.out.print( "KeyChar=" + e.getKeyChar());
System.out.print( " KeyCode=" + e.getKeyCode() );
System.out.println(" KeyText=" +
e.getKeyText(e.getKeyCode()));
}
}
---------------------------------- Cut Here
----------------------------------