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

(int)KeyEvent.getKeyChar() returns 0xff08 for backspace

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P4 P4
    • None
    • 1.1
    • client-libs
    • None
    • sparc
    • solaris_2.5



      Name: mc57594 Date: 03/07/97


      (int)KeyEvent.getKeyChar() returns 0xff08 when the key is a
      backspace
      while (int)'\b' = 0x0008. This impacts checking characters
      typed
      in for backspace. Workaround is to also check the key
      code
      (eg getKeyCode() == KeyEvent.VK_BACK_SPACE).
      This only happens on solaris appletviewer, not on Windows 95
      appletviewer
      ******* TESTCASE
      ******
      import
      java.awt.*;
      import
      java.awt.event.*;
      import
      java.applet.*;
      public class Bug13Applet extends Applet implements
      KeyListener
      {
        TextField tf1 = new TextField("Type backspace in
      me");
        public void
      init()
       
      {
         
      tf1.addKeyListener(this);
         
      add(tf1);
       
      }
        public void keyReleased(KeyEvent e)
      {}
        public void keyTyped(KeyEvent e)
      {}
        public void keyPressed(KeyEvent
      e)
       
      {
         
      System.out.println(e.toString());
          System.out.println("(int)getKeyChar() = " +
      (int)(e.getKeyChar()));
          System.out.println("(int)'\\b' = " +
      ((int)'\b'));
       
      }
      }
      ======================================================================

            ehawkessunw Eric Hawkes (Inactive)
            mchamnessunw Mark Chamness (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: