-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.1.8
-
None
-
generic
-
generic
The fix for 4174399 does not work for KEY_TYPED events and is considered only a partial fix. The behaviour still remains inconsistent between Solaris and win32.
import java.awt.*;
import java.awt.event.*;
public class ModifierTest extends Frame implements KeyListener{
TextArea ta;
public ModifierTest() {
ta = new TextArea(8, 30);
ta.addKeyListener(this);
add(ta);
pack();
show();
}
public static void main(String[] args) {
new ModifierTest();
}
public void keyPressed(KeyEvent e) {
System.out.println(e);
}
public void keyReleased(KeyEvent e) {
System.out.println(e);
}
public void keyTyped(KeyEvent evt) {
System.out.println(evt);
}
}
E.g. press Shift-A when focus is inside the TextArea.
On Solaris:
$ uname -a
SunOS ibm7 5.6 Generic_105181-05 sun4u sparc SUNW,Ultra-1
$ /usr/local/java/jdk1.1.8/solaris/bin/java -fullversion
java full version "JDK1.1.8I"
$ /usr/local/java/jdk1.1.8/solaris/bin/java ModifierTest
java.awt.event.KeyEvent[KEY_PRESSED,keyCode=16,keyChar='',modifiers=Shift] on text0
java.awt.event.KeyEvent[KEY_PRESSED,keyCode=65,keyChar='A',modifiers=Shift] on text0
java.awt.event.KeyEvent[KEY_TYPED,keyCode=0,keyChar='A'] on text0
java.awt.event.KeyEvent[KEY_RELEASED,keyCode=65,keyChar='A',modifiers=Shift] on text0
java.awt.event.KeyEvent[KEY_RELEASED,keyCode=16,keyChar='',modifiers=Shift] on text0
There are no modifiers for the KEY_TYPED event. On WinNT (4.0 SP3) the following output is obtained:
D:\KeyTest>\JDK1.1.8I-bin\jdk1.1.8\bin\java -fullversion
java full version "JDK1.1.8I"
D:\KeyTest>\JDK1.1.8I-bin\jdk1.1.8\bin\java ModifierTest
java.awt.event.KeyEvent[KEY_PRESSED,keyCode=16,keyChar=' ',modifiers=Shift] on t
ext0
java.awt.event.KeyEvent[KEY_PRESSED,keyCode=65,keyChar='A',modifiers=Shift] on t
ext0
java.awt.event.KeyEvent[KEY_TYPED,keyCode=0,keyChar='A',modifiers=Shift] on text
0
java.awt.event.KeyEvent[KEY_RELEASED,keyCode=65,keyChar='A',modifiers=Shift] on
text0
java.awt.event.KeyEvent[KEY_RELEASED,keyCode=16,keyChar=' '] on text0
This behaviour on NT is the same as 1.1.7B.
stuart.lawrence@eng 1999-03-16
import java.awt.*;
import java.awt.event.*;
public class ModifierTest extends Frame implements KeyListener{
TextArea ta;
public ModifierTest() {
ta = new TextArea(8, 30);
ta.addKeyListener(this);
add(ta);
pack();
show();
}
public static void main(String[] args) {
new ModifierTest();
}
public void keyPressed(KeyEvent e) {
System.out.println(e);
}
public void keyReleased(KeyEvent e) {
System.out.println(e);
}
public void keyTyped(KeyEvent evt) {
System.out.println(evt);
}
}
E.g. press Shift-A when focus is inside the TextArea.
On Solaris:
$ uname -a
SunOS ibm7 5.6 Generic_105181-05 sun4u sparc SUNW,Ultra-1
$ /usr/local/java/jdk1.1.8/solaris/bin/java -fullversion
java full version "JDK1.1.8I"
$ /usr/local/java/jdk1.1.8/solaris/bin/java ModifierTest
java.awt.event.KeyEvent[KEY_PRESSED,keyCode=16,keyChar='',modifiers=Shift] on text0
java.awt.event.KeyEvent[KEY_PRESSED,keyCode=65,keyChar='A',modifiers=Shift] on text0
java.awt.event.KeyEvent[KEY_TYPED,keyCode=0,keyChar='A'] on text0
java.awt.event.KeyEvent[KEY_RELEASED,keyCode=65,keyChar='A',modifiers=Shift] on text0
java.awt.event.KeyEvent[KEY_RELEASED,keyCode=16,keyChar='',modifiers=Shift] on text0
There are no modifiers for the KEY_TYPED event. On WinNT (4.0 SP3) the following output is obtained:
D:\KeyTest>\JDK1.1.8I-bin\jdk1.1.8\bin\java -fullversion
java full version "JDK1.1.8I"
D:\KeyTest>\JDK1.1.8I-bin\jdk1.1.8\bin\java ModifierTest
java.awt.event.KeyEvent[KEY_PRESSED,keyCode=16,keyChar=' ',modifiers=Shift] on t
ext0
java.awt.event.KeyEvent[KEY_PRESSED,keyCode=65,keyChar='A',modifiers=Shift] on t
ext0
java.awt.event.KeyEvent[KEY_TYPED,keyCode=0,keyChar='A',modifiers=Shift] on text
0
java.awt.event.KeyEvent[KEY_RELEASED,keyCode=65,keyChar='A',modifiers=Shift] on
text0
java.awt.event.KeyEvent[KEY_RELEASED,keyCode=16,keyChar=' '] on text0
This behaviour on NT is the same as 1.1.7B.
stuart.lawrence@eng 1999-03-16
- duplicates
-
JDK-4193779 Modifiers not delivered with KEY_TYPED events on Solaris.
- Resolved
- relates to
-
JDK-4209844 Modifiers not set for KEY_TYPED events on win32
- Closed
-
JDK-4174399 KeyEvent modifiers not working on unix platforms
- Closed