-
Bug
-
Resolution: Fixed
-
P2
-
1.1.6, 1.1.7
-
b01
-
sparc
-
solaris_2.5.1, solaris_2.6
Name: moC74494 Date: 05/15/98
Start applet, hit tab to shift keyboard focus to label.
Press 'Shift' then 'z'
No KEY_PRESSED event is generated for the 'z' key.
Pressing 'Control' then 'z' will generate a PRESSED event for the 'z' key properly.
Also to note, the order of PRESSED/TYPED/RELEASED events has changed from 1.1.5
1.1.5 generated the PRESSSED event then the TYPED event then the RELEASE.
1.1.6 generates the TYPED event then the PRESSED then the RELEASED.
Sample run of applet.
-------------------------------
ares% appletviewer ki.html
Released = java.awt.event.KeyEvent[KEY_RELEASED,keyCode=9,Tab] on label1
Pressed = java.awt.event.KeyEvent[KEY_PRESSED,keyCode=16,keyChar='?'] on label1
Typed = java.awt.event.KeyEvent[KEY_TYPED,keyCode=0,keyChar='Z'] on label1
Released = java.awt.event.KeyEvent[KEY_RELEASED,keyCode=90,keyChar='Z',modifiers=Shift] on label1
Released = java.awt.event.KeyEvent[KEY_RELEASED,keyCode=16,keyChar='',modifiers=Shift] on label1
-------------------------------
-ki.html-------------8<--------------------------------------
<applet code=KeyInput width=300 height=300>
</applet>
--------8<--------------------------------------
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class KeyInput extends Applet implements KeyListener
{
public void init() {
Label x = new Label("Type Here");
add(x);
x.addKeyListener(this);
}
public void keyTyped(KeyEvent e) {
System.out.println("Typed = " + e);
}
public void keyPressed(KeyEvent e) {
System.out.println("Pressed = " + e);
}
public void keyReleased(KeyEvent e) {
System.out.println("Released = " + e);
}
}
---------------------8<-------------------------------------
(Review ID: 29912)
======================================================================
jukka.tammisto@canada 1998-06-19
Description (including a test case) from incident 33937:
--------------------------------------------------------
Run the following program. Typing in the box without
pressing shift will generate keyevents. With shift pressed,
nothing happens.
This only happens in 1.1.6 - it works ok in 1.1.5 and 1.2beta3.
---
package bugs;
import java.awt.*;
import java.awt.event.*;
/**
* The following program will print out the incoming key events.
* On Solaris 2.5.1, jdk1.1.6, no key events will be generated if the
* shift key has been pressed - ie, no upper case characters can be input.
* jdk1.1.5 works correctly, as does jdk1.2beta3
*/
public class ShiftBug extends Canvas {
public ShiftBug() {
setSize(100,100);
addMouseListener(new MyMouseListener());
addKeyListener(new MyKeyListener());
}
public class MyMouseListener extends MouseAdapter {
public void mouseEntered(MouseEvent evt) {
requestFocus();
}
}
public class MyKeyListener extends KeyAdapter {
public void keyPressed(KeyEvent evt) {
System.out.println("got " + evt);
}
}
public static void main(String[] args) {
Frame f = new Frame("ShiftBug");
f.add(new ShiftBug());
f.setSize(100,100);
f.setVisible(true);
}
}
jukka.tammisto@canada 1998-06-19
Output in JDK-1.1.5
-------------------
The I one is for 'Shift' and the II is for 'A'.
got java.awt.event.KeyEvent[KEY_PRESSED,keyCode=16,keyChar=''] on canvas0
got java.awt.event.KeyEvent[KEY_PRESSED,keyCode=65,keyChar='A',modifiers=Shift] on canvas0
Output in JDK-1.1.6 and JDK-1.1.7
---------------------------------
The output is for 'Shift', no output for 'A'.
got java.awt.event.KeyEvent[KEY_PRESSED,keyCode=16,keyChar='?'] on canvas0
- duplicates
-
JDK-4156752 Java AWT: Input Method not de-installed because no focus out event delivered
-
- Closed
-
- relates to
-
JDK-4138880 JDK1.1.6: KeyEvent.getKeyChar returns wrong code
-
- Closed
-