Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6871299

Shift+Tab no longer generates a KEY_TYPED event; used to with JRE 1.5

    Details

    • Subcomponent:
    • Introduced In Build:
      b40
    • Introduced In Version:
      6
    • Resolved In Build:
      b72
    • CPU:
      x86
    • OS:
      linux_ubuntu

      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.

        Activity

        Hide
        dcherepanov Dmitry Cherepanov added a comment -
        BT2:EVALUATION

        It's most likely a regression of one of the enhancements introduced in jdk6 b40.
        Show
        dcherepanov Dmitry Cherepanov added a comment - BT2:EVALUATION It's most likely a regression of one of the enhancements introduced in jdk6 b40.
        Hide
        yan Yuri Nesterenko added a comment -
        BT2:EVALUATION

        Exactly. ISO_Left_Tab should be processed just like regular Tab.
        Show
        yan Yuri Nesterenko added a comment - BT2:EVALUATION Exactly. ISO_Left_Tab should be processed just like regular Tab.

          People

          • Assignee:
            yan Yuri Nesterenko
            Reporter:
            ndcosta Nelson Dcosta
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              Imported:
              Indexed: