001: /*
002: * (C) Copyright IBM Corp. 1998-2004. All Rights Reserved.
003: *
004: * The program is provided "as is" without any warranty express or
005: * implied, including the warranty of non-infringement and the implied
006: * warranties of merchantibility and fitness for a particular purpose.
007: * IBM will not be liable for any damages suffered by you as a result
008: * of using the Program. In no event will IBM be liable for any
009: * special, indirect or consequential damages or lost profits even if
010: * IBM has been advised of the possibility of their occurrence. IBM
011: * will not be liable for any third party claims against you.
012: */
013: /*
014: *
015: * (C) Copyright IBM Corp. 1998, All Rights Reserved
016: */
017:
018: package com.ibm.richtext.textpanel;
019:
020: import java.awt.event.KeyEvent;
021:
022: /**
023: * This class simulates a Nikud keyboard on a US-English
024: * keyboard. It is very much a work in progress.
025: */
026:
027: final class IsraelNikudKeyboard extends KeyRemap {
028:
029: static final String COPYRIGHT = "(C) Copyright IBM Corp. 1998-1999 - All Rights Reserved";
030:
031: public char remap(char c) {
032:
033: switch (c) {
034: case 't':
035: return '\u05D0'; // alef
036: case 'c':
037: return '\u05D1'; // bet
038: case 'd':
039: return '\u05D2'; // gimel
040: case 's':
041: return '\u05D3'; // dalet
042: case 'v':
043: return '\u05D4'; // he
044: case 'u':
045: return '\u05D5'; // vav
046: case 'z':
047: return '\u05D6'; // zayin
048: case 'j':
049: return '\u05D7'; // het
050: case 'y':
051: return '\u05D8'; // tet
052: case 'h':
053: return '\u05D9'; // yod
054: case 'l':
055: return '\u05DA'; // final kaf
056: case 'f':
057: return '\u05DB'; // kaf
058: case 'k':
059: return '\u05DC'; // lamed
060: case 'o':
061: return '\u05DD'; // final mem
062: case 'n':
063: return '\u05DE'; // mem
064: case 'i':
065: return '\u05DF'; // final nun
066: case 'b':
067: return '\u05E0'; // nun
068: case 'x':
069: return '\u05E1'; // samech
070: case 'g':
071: return '\u05E2'; // ayin
072: case ';':
073: return '\u05E3'; // final pe
074: case 'p':
075: return '\u05E4'; // pe
076: case '.':
077: return '\u05E5'; // final tsadi
078: case 'm':
079: return '\u05E6'; // tsadi
080: case 'e':
081: return '\u05E7'; // qof
082: case 'r':
083: return '\u05E8'; // resh
084: case 'a':
085: return '\u05E9'; // shin
086: case ',':
087: return '\u05EA'; // tav
088: case 'w':
089: return ',';
090: case 'q':
091: return '/';
092: case '/':
093: return '.';
094: }
095:
096: return c;
097: }
098:
099: public char remap(KeyEvent keyEvent) {
100:
101: // Note: only one ctrl case now (ctrl-/ -> dagesh).
102: // Better implementation will be needed for more cases.
103:
104: if (keyEvent.isControlDown()) {
105: if (keyEvent.getKeyCode() == KeyEvent.VK_SLASH) {
106: return '\u05BC'; // dagesh
107: }
108: }
109:
110: return remap(keyEvent.getKeyChar());
111: }
112: }
|