|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.event.KeyAdapter
net.sourceforge.vietpad.inputmethod.VietKeyListener
public class VietKeyListener
Listener for Vietnamese key entries.
Acts as an input preprocessor to VietKeyInput
module, the keyboard engine.
A listener object created from this class, when registered with a text component
using the component's addKeyListener
method,
gives the component the capability of Vietnamese text input.
The class has numerous static methods to provide extra niceties
to the registered text components. It includes support for shorthand,
smart marking, and selection of popular Vietnamese input methods. A typical application is as follows:
JTextComponent textComp = new JTextArea(); VietKeyListener keyLst = new VietKeyListener(textComp); textComp.addKeyListener(keyLst); VietKeyListener.setInputMethod(InputMethods.Telex); VietKeyListener.setVietModeEnabled(true); VietKeyListener.setSmartMark(true);A convenient JAR package is provided for easy integration to your program. A practical example can be found in VietPad, a full-featured Vietnamese Unicode text editor.
Constructor Summary | |
---|---|
VietKeyListener(JComboBox comboBox)
Creates a new VietKeyListener . |
|
VietKeyListener(JTextComponent textComponent)
Creates a new VietKeyListener . |
Method Summary | |
---|---|
static void |
consumeRepeatKey(boolean mode)
Sets to consume the accent key when it is repeated to remove the diacritical mark just entered. |
static InputMethods |
getInputMethod()
Gets the current input method. |
void |
keyTyped(KeyEvent e)
Invoked when a key has been typed. |
static void |
setDiacriticsPosClassic(boolean classic)
Sets the diacritics position to follow the classic style (òa, òe, úy), as opposed to the modern style (oà, oè, uý). |
static void |
setInputMethod(InputMethods method)
Sets the input method. |
static void |
setMacroMap(Properties shortHandMap)
Sets map for shorthand. |
static void |
setSmartMark(boolean smartMark)
Sets the SmartMark capability on or off. |
static void |
setVietModeEnabled(boolean mode)
Enables Vietnamese mode for key input. |
Methods inherited from class java.awt.event.KeyAdapter |
---|
keyPressed, keyReleased |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public VietKeyListener(JTextComponent textComponent)
VietKeyListener
.
textComponent
- the JTextComponent to be listenedpublic VietKeyListener(JComboBox comboBox)
VietKeyListener
.
comboBox
- the JComboBox to be listenedMethod Detail |
---|
public static void setVietModeEnabled(boolean mode)
mode
- true to enable entry of Vietnamese characters (enabled by default)public static void setInputMethod(InputMethods method)
method
- one of the supported input methods: VNI, VIQR, or Telex (default)public static InputMethods getInputMethod()
public static void setSmartMark(boolean smartMark)
smartMark
- true to enable automatic placement of diacritical marks on appropriate vowels in a word;public static void setDiacriticsPosClassic(boolean classic)
classic
- true for classic; false for modern (default)public static void setMacroMap(Properties shortHandMap)
shortHandMap
- the list of shorthand sequencespublic void keyTyped(KeyEvent e)
keyTyped
in interface KeyListener
keyTyped
in class KeyAdapter
e
- invoked when a key has been typed. This event occurs when a key press is followed by a key release.public static void consumeRepeatKey(boolean mode)
mode
- true to consume the accent key when it is used to remove the diacritical mark just entered; false otherwise
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |