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

Arrow keys don't function properly in TextField if num. lock set.

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      1.1.4
    • CPU:
      sparc
    • OS:
      solaris_2.5.1, solaris_2.6, solaris_9
    • Verification:
      Not verified

      Description

      Number Lock should only affect the arrow keys on the numeric keypad, but it also affects the non-numeric-keypad arrow keys. When num. lock is set, these arrow keys also echo 2,4,6 and 8.

      To reproduce:
      1. Click in TextField (I tested using HotJava 1.0_17 and the "Places" (URL) TextField)
      2. Turn on num. lock
      3. Try using the arrow keys that are not on the numeric keypad. They will behave like the arrow keys on the numeric keypad and echo numbers instead of functioning as arrows.

      This occured using jvm11_13 green_threads.



      Here is an example piece of code to reproduce this problem

      import java.applet.*;
      import java.lang.*;
      import java.awt.*;
      import java.awt.event.*;

      public class Key extends Applet
      {
      private KeyWatch keyear;
      private Button but1;
      private Button but2;
      private TextField fld;

      public Key() {}

      public void init()
      {
      keyear = new KeyWatch();

      this.setLayout(new FlowLayout(FlowLayout.CENTER, 30, 30));

      but1 = new Button("Press Me");
      but2 = new Button("Hit Me");
      fld = new TextField("Some Text");

      this.add(but1);
      this.add(but2);
      this.add(fld);

      but1.addKeyListener(keyear);
      but2.addKeyListener(keyear);
      fld.addKeyListener(keyear);

      this.addKeyListener(keyear);
      }
      }

      class KeyWatch extends KeyAdapter
      {
      public void keyPressed(KeyEvent e)
      {
      System.out.print("KeyChar=" + e.getKeyChar());
      System.out.print(" KeyCode=" + e.getKeyCode() );
      System.out.println(" KeyText=" + e.getKeyText(e.getKeyCode()));
      }
      }

      And a suitable html file would be ..
      <HTML>
      <BODY>
      <APPLET CODE="Key.class" WIDTH=400 HEIGHT=400>
      </APPLET>
      </BODY>
      </HTML>

      Click in the text field or any of the buttons and start pressing keys. Look
      closely how the numeric keypad and the cursor key behave when the numlock
      is on and off.

      north@UK 1997-10-07

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              gsaab Georges Saab
              Reporter:
              duke J. Duke (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: