-
Bug
-
Resolution: Cannot Reproduce
-
P4
-
None
-
1.2.0
-
x86
-
windows_nt
Name: eh37734 Date: 10/16/98
Dear Bug Report,
On a Wintel system running Windows NT 4.0 SP 3, executing the program below under
JDK 1.2 Beta 4 and then pressing the "+" key on main part of the keyboard goes not generate a
KEY_PRESSED event. Only a KEY_TYPED event is generated. JDK 1.1.6 does generate a KEY_PRESSED
event for the same program.
In JDK 1.2 Beta 4 the "+" key on the main keyboard does not generate the KEY_PRESSED event,
but the "+" key on the numeric keypad does.
There is a similar problem with the "-" key.
Sincerely,
Thorn Green
Program Code:
-------------
package geomdir;
import java.awt.*;
import java.awt.event.*;
import com.sun.java.swing.*;
import com.sun.java.swing.border.*;
class MyComp extends JComponent
{
JFrame ParentFrame = null;
public MyComp( JFrame in )
{
ParentFrame = in;
enableEvents( AWTEvent.KEY_EVENT_MASK );
}
public void processKeyEvent( KeyEvent e )
{
char c = e.getKeyChar();
if( c == '+' )
{
if( e.getID() == KeyEvent.KEY_PRESSED )
System.out.println( "Pressed a Plus!!!" );
if( e.getID() == KeyEvent.KEY_RELEASED )
System.out.println( "Released a Plus!!!" );
if( e.getID() == KeyEvent.KEY_TYPED )
System.out.println( "Key Typed Event on Plus!!!" );
}
super.processKeyEvent( e );
}
public boolean isFocusTraversable( )
{ return( true ); }
}
public class TestApp2 extends Object
{
protected static JFrame MyF;
protected static MyComp MyKit;
protected static void initialize( String argv[] )
{
MyF = new JFrame();
MyF.setSize( 400 , 400 );
MyF.pack();
MyF.setTitle( "Model Window" );
MyKit = new MyComp( MyF );
JPanel kPan = new JPanel();
MyF.getContentPane().setLayout( new BorderLayout( 0 , 0 ) );
MyF.getContentPane().add( "Center" , MyKit );
}
public static void main( String argv[] )
{
initialize( argv );
MyF.pack();
MyF.setSize( 400 , 400 );
MyF.setVisible( true );
MyKit.requestFocus();
}
}
(Review ID: 37601)
======================================================================