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

keyReleased behaviour incorrect

XMLWordPrintable

    • Fix Understood
    • x86, sparc
    • linux, solaris_2.5.1

      Name: mf23781 Date: 06/29/98


      The Event tests in the JCK:

      api/java_awt/interactive/EventTests.html

      fail on Solaris due to the fact that keyReleased implements
      incorrect behaviour. On Solaris the keyReleased event occurs
      after about half a second regardless of whether the key has
      been released or not. This is not a problem on NT as everything
      works as designed.

      The test case below shows this.

      import java.util.*;
      import java.awt.*;
      import java.awt.event.*;
      import java.io.*;

      public class testkey extends Frame
      {

         public void init( ){
            checkKey check = new checkKey();
            setSize( 300, 300 );
            setLayout(new GridLayout(0,1));
            TextField message = new TextField( "Hello Sailor" );
            message.addKeyListener( check );
            add( message );
         }
         public static void main( String args[] )
         {
            testkey test = new testkey();
            test.init( );
            test.show( );
         }
         void testkey( )
         {
         }
      }

      class checkKey implements KeyListener
      {
         public int KeyHits = 0;
         public void keyTyped( java.awt.event.KeyEvent e ) {
      // System.out.println( e );
         }
         public void keyPressed( java.awt.event.KeyEvent e ) {
      // System.out.println( e );
         }
         public void keyReleased( java.awt.event.KeyEvent e ) {
            System.out.println( e );
            KeyHits++;
         }
      }

      Uncomment the System.out lines and another possible problem
      can be seen. keyPressed and keyTyped events are generated for
      each auto repeat if the key is held down. Is this behaving as
      designed?
      ======================================================================
      ###@###.### 10/5/04 07:42 GMT

            yan Yuri Nesterenko
            miflemi Mick Fleming
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: