Back to index

wims  3.65+svn20090927
KeyDictionary.java
Go to the documentation of this file.
00001 package rene.gui;
00002 
00003 import java.awt.event.KeyEvent;
00004 import java.util.Hashtable;
00005 
00014 class KeyDictionary
00015 {      static Hashtable H;
00016        static
00017        {      H=new Hashtable(100);
00018               put(KeyEvent.VK_F1,"f1");
00019               put(KeyEvent.VK_F2,"f2");
00020               put(KeyEvent.VK_F3,"f3");
00021               put(KeyEvent.VK_F4,"f4");
00022               put(KeyEvent.VK_F5,"f5");
00023               put(KeyEvent.VK_F6,"f6");
00024               put(KeyEvent.VK_F7,"f7");
00025               put(KeyEvent.VK_F8,"f8");
00026               put(KeyEvent.VK_F9,"f9");
00027               put(KeyEvent.VK_F10,"f10");
00028               put(KeyEvent.VK_F11,"f11");
00029               put(KeyEvent.VK_F12,"f12");
00030               put(KeyEvent.VK_LEFT,"left");
00031               put(KeyEvent.VK_RIGHT,"right");
00032               put(KeyEvent.VK_DOWN,"down");
00033               put(KeyEvent.VK_UP,"up");
00034               put(KeyEvent.VK_PAGE_DOWN,"page down");
00035               put(KeyEvent.VK_PAGE_UP,"page up");
00036               put(KeyEvent.VK_DELETE,"delete");
00037               put(KeyEvent.VK_BACK_SPACE,"backspace");
00038               put(KeyEvent.VK_INSERT,"insert");
00039               put(KeyEvent.VK_HOME,"home");
00040               put(KeyEvent.VK_END,"end");
00041               put(KeyEvent.VK_ESCAPE,"escape");
00042               put(KeyEvent.VK_TAB,"tab");
00043               put(KeyEvent.VK_ENTER,"enter");           
00044        }
00045        static void put (int code, String name)
00046        {      H.put(new Integer(code),name);
00047        }
00048        static String translate (int code)
00049        {      Object o=H.get(new Integer(code));
00050               if (o!=null) return (String)o;
00051               return KeyEvent.getKeyText(code);
00052        }
00053 }
00054