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

numpad (KeyChar=,KeyCode=110 KeyText=NUM .) numpad does not generate any key ev

XMLWordPrintable

    • x86
    • solaris_8

      Keywords
      java, solaris, jdk, keycode, keyevent, numpad, numlock,
      keypressed

      Product java/solaris/classes_awt

      On Solaris, the decimal point key on the numpad (KeyChar=,
      KeyCode=110 KeyText=NUM .)
      does not generate any key
      events(KeyPressed/KeyReleased/KeyTyped).
      Note that the "," character is actually displayed in the
      text field
      despite the fact that no event has been generated!

      This has been verified on Solaris Sparc and Solaris Intel
      with all
      available versions of jdk 1.1.x, jdk 1.2.x

      Here is the sample code to reproduce the problem:

      The file Key.html:
      ---------------------------------- Cut Here
      ----------------------------------
      <html>
      <head>
      <title>The NumPad Test Applet</title>
      </head>
      <body>
      <p>
      <applet code="Key.class" width=500 height=300>
      </applet>
      </body>
      </html>
      ---------------------------------- Cut Here
      ----------------------------------

      The file Key.java:
      ---------------------------------- Cut Here
      ----------------------------------
      import java.applet.*;
      import java.lang.*;
      import java.awt.*;
      import java.awt.event.*;

      public class Key extends Applet {
              private TextField tf;

              public void init() {
                      this.setLayout(new
      FlowLayout(FlowLayout.CENTER, 30, 30));

                      tf = new TextField("ABCD",20);
                      this.add(tf);

                      tf.addKeyListener(
      new KeyListener() {
                public void keyTyped(KeyEvent e) {
      System.out.print( "KeyTyped: ");
      printKeyInfo(e);
      }
               public void keyReleased(KeyEvent e) {
      System.out.print( "KeyReleased: ");
      printKeyInfo(e);
      System.out.println("----------------");
               }
              public void keyPressed(KeyEvent e) {
      System.out.print( "KeyPressed: ");
      printKeyInfo(e);
      }
               } );
                      tf.addActionListener(
                   new ActionListener() {
                       public void actionPerformed( ActionEvent e
      ) {
                           System.out.println( e );
                       }
                   } );
              }


              public void printKeyInfo(KeyEvent e) {
      System.out.print( "KeyChar=" + e.getKeyChar());
      System.out.print( " KeyCode=" + e.getKeyCode() );
      System.out.println(" KeyText=" +
      e.getKeyText(e.getKeyCode()));
      }
      }
      ---------------------------------- Cut Here
      ----------------------------------

            ehawkessunw Eric Hawkes (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: