JDK-6871299 : Shift+Tab no longer generates a KEY_TYPED event; used to with JRE 1.5
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 6u14
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux_ubuntu
  • CPU: x86
  • Submitted: 2009-08-13
  • Updated: 2014-10-24
  • Resolved: 2009-09-16
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7
7 b72Fixed
Description
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.

Comments
EVALUATION Exactly. ISO_Left_Tab should be processed just like regular Tab.
04-09-2009

EVALUATION It's most likely a regression of one of the enhancements introduced in jdk6 b40.
28-08-2009