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

Using jdk 1.1.4, numpad works differently in WinNT than in Solaris.

    XMLWordPrintable

Details

    • 1.2beta3
    • generic
    • solaris_2.5.1
    • Not verified

    Description

      Here is an example showing a different behaviour with numpad between jdk 1.1.4
      for winNT 4.0 and jdk 1.1.4 for solaris 2.5.1.

      % cat MyTextField.java
      import java.awt.*;
      import java.awt.event.*;

      public class MyTextField extends TextField {

      protected void processKeyEvent( KeyEvent k ) {
      String s="K ";
                 if (k.getKeyCode()==KeyEvent.VK_NUMPAD1){
                    s+=" VK_NUMPAD1 ";
                 }else if (k.getKeyCode()==KeyEvent.VK_END){
                    s+=" VK_END ";
                 }
                 if (k.getKeyCode()==KeyEvent.VK_NUMPAD0){
                    s+=" VK_NUMPAD0 ";
                 }else if (k.getKeyCode()==KeyEvent.VK_INSERT){
                    s+=" VK_INSERT ";
                 }
                 s+="<"+k.getKeyCode()+"> "+k.getKeyChar();
                 System.out.println(s);
      }

      public MyTextField() {
      enableEvents(AWTEvent.KEY_EVENT_MASK);
      }

      public static void main( String[] args ) {
      Frame f = new Frame();
      f.setSize( 200, 100 );
      f.add( new MyTextField() );
      f.show();
      }
      }
      %

      Under solaris 2.5.1, with or without NumLock pressed, the keycode of a numpoad
      key is the same.
      Under winNT, there is a difference if NumLock is pressed or not.

      Example of output for the key "8" :

      Under Solaris :
      without or with NumLock, we've got K <38>

      Under WinNT :
      without NumLock, we've got K <38>
      but with NumLock, we've got K <104>
       

      Attachments

        Activity

          People

            cchongsunw Creighton Chong (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: