-
Bug
-
Resolution: Fixed
-
P3
-
6u14
FULL PRODUCT VERSION :
java version "1.6.0_14"
Java(TM) SE Runtime Environment (build 1.6.0_14-b08)
Java HotSpot(TM) Server VM (build 14.0-b16, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux sapient 2.6.28-13-generic #45-Ubuntu SMP Tue Jun 30 22:12:12 UTC 2009 x86_64 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
If I type Shift+Tab under JRE 1.5, I get a KEY_TYPED event. I do not get it with JRE 1.6 and OpenJDK 7.
The KEY_TYPED event is only missing for Shift+Tab. Ctrl+Tab is OK, and Shift+Enter is OK as well.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the app provided below. Then press Shift+Tab and watch stdout.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
This is what JRE 1.5 emits when pressing Shift+Tab:
PRESSED: code=16, char=65535, mods=1, action=false
PRESSED: code=9, char=9, mods=1, action=false
TYPED: code=0, char=9, mods=1, action=false
RELEASED: code=9, char=9, mods=1, action=false
RELEASED: code=16, char=65535, mods=0, action=false
ACTUAL -
Under JRE 1.6 and a preview of OpenJDK 7, I get only:
PRESSED: code=16, char=65535, mods=1, action=false
PRESSED: code=9, char=65535, mods=1, action=false
RELEASED: code=9, char=65535, mods=1, action=false
RELEASED: code=16, char=65535, mods=0, action=false
The TYPED event is missing.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.AWTEvent;
import java.awt.EventQueue;
import java.awt.Toolkit;
import java.awt.event.KeyEvent;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;
public class KeyEvents
{
public static void main( String[] args )
{
EventQueue queue = new EventQueue()
{
@Override
protected void dispatchEvent( AWTEvent _event )
{
if (_event instanceof KeyEvent)
log( (KeyEvent) _event );
super.dispatchEvent( _event );
}
};
Toolkit.getDefaultToolkit().getSystemEventQueue().push( queue );
JFrame frame = new JFrame( "KeyEvents" );
JPanel panel = new JPanel();
frame.add( panel );
panel.add( new JTextField( 20 ) );
panel.add( new JTextField( 20 ) );
frame.pack();
frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
frame.setVisible( true );
}
protected static void log( KeyEvent _e )
{
System.out.println( idText( _e.getID() ) + ": code=" + _e.getKeyCode() + ", char=" + (int) _e.getKeyChar()
+ ", mods=" + _e.getModifiers() + ", action=" + _e.isActionKey() );
}
private static String idText( int _id )
{
switch (_id) {
case KeyEvent.KEY_PRESSED:
return "PRESSED";
case KeyEvent.KEY_TYPED:
return "TYPED";
case KeyEvent.KEY_RELEASED:
return "RELEASED";
default:
return Integer.toString( _id );
}
}
}
---------- END SOURCE ----------
Release Regression From : 5.0
The above release value was the last known release where this
bug was not reproducible. Since then there has been a regression.
java version "1.6.0_14"
Java(TM) SE Runtime Environment (build 1.6.0_14-b08)
Java HotSpot(TM) Server VM (build 14.0-b16, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux sapient 2.6.28-13-generic #45-Ubuntu SMP Tue Jun 30 22:12:12 UTC 2009 x86_64 GNU/Linux
A DESCRIPTION OF THE PROBLEM :
If I type Shift+Tab under JRE 1.5, I get a KEY_TYPED event. I do not get it with JRE 1.6 and OpenJDK 7.
The KEY_TYPED event is only missing for Shift+Tab. Ctrl+Tab is OK, and Shift+Enter is OK as well.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the app provided below. Then press Shift+Tab and watch stdout.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
This is what JRE 1.5 emits when pressing Shift+Tab:
PRESSED: code=16, char=65535, mods=1, action=false
PRESSED: code=9, char=9, mods=1, action=false
TYPED: code=0, char=9, mods=1, action=false
RELEASED: code=9, char=9, mods=1, action=false
RELEASED: code=16, char=65535, mods=0, action=false
ACTUAL -
Under JRE 1.6 and a preview of OpenJDK 7, I get only:
PRESSED: code=16, char=65535, mods=1, action=false
PRESSED: code=9, char=65535, mods=1, action=false
RELEASED: code=9, char=65535, mods=1, action=false
RELEASED: code=16, char=65535, mods=0, action=false
The TYPED event is missing.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.AWTEvent;
import java.awt.EventQueue;
import java.awt.Toolkit;
import java.awt.event.KeyEvent;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;
public class KeyEvents
{
public static void main( String[] args )
{
EventQueue queue = new EventQueue()
{
@Override
protected void dispatchEvent( AWTEvent _event )
{
if (_event instanceof KeyEvent)
log( (KeyEvent) _event );
super.dispatchEvent( _event );
}
};
Toolkit.getDefaultToolkit().getSystemEventQueue().push( queue );
JFrame frame = new JFrame( "KeyEvents" );
JPanel panel = new JPanel();
frame.add( panel );
panel.add( new JTextField( 20 ) );
panel.add( new JTextField( 20 ) );
frame.pack();
frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
frame.setVisible( true );
}
protected static void log( KeyEvent _e )
{
System.out.println( idText( _e.getID() ) + ": code=" + _e.getKeyCode() + ", char=" + (int) _e.getKeyChar()
+ ", mods=" + _e.getModifiers() + ", action=" + _e.isActionKey() );
}
private static String idText( int _id )
{
switch (_id) {
case KeyEvent.KEY_PRESSED:
return "PRESSED";
case KeyEvent.KEY_TYPED:
return "TYPED";
case KeyEvent.KEY_RELEASED:
return "RELEASED";
default:
return Integer.toString( _id );
}
}
}
---------- END SOURCE ----------
Release Regression From : 5.0
The above release value was the last known release where this
bug was not reproducible. Since then there has been a regression.