Key Codes

Not all keyboards are created alike. Macs have Command and option keys. PCs have Alt keys. Some PCs have a Windows 95 key. Some don't. Some keyboards have numeric keypads, but many don't. Emacs expects there to be a Meta key which I for one have never actually seen on any keyboard in existence, but which is often mapped to the Escape key (which is again a key some keyboards don't have). Keyboard inconsistency is one of the problems a truly cross-platform environment has to deal with.

The KeyEvent class defines a little more than one hundred virtual key codes that map to different, common, keyboard keys. KeyEvent.VK_0 thru KeyEvent.VK_9 are the same as ASCII '0' thru '9' (0x30 - 0x39)

KeyEvent.VK_A thru KeyEvent.VK_Z are the same as ASCII 'A' thru 'Z'; that is, KeyEvent.VK_A, KeyEvent.VK_B, KeyEvent.VK_C, KeyEvent.VK_D, KeyEvent.VK_E, KeyEvent.VK_F, and so on.


Previous | Next | Top
Last Modified June 25, 1998
Copyright 1997, 1998 Elliotte Rusty Harold
elharo@sunsite.unc.edu