Input Vietnamese Unicode text in Java applications and applets with VietIME    (English | Vietnamese)

VietIME, or Vietnamese Input Method Editor, is a Java application that uses the input method framework in the Java 2 platform (1.3 or higher) to enable the collaboration between text editing components and input methods in entering Vietnamese text with any Java runtime environment. Text editing components that use the input method framework run on any Java application environment and support any text input methods available on that Java application environment without modifying or recompiling the text editing component.

System Requirements

  1. Java 2 Runtime Environment (1.3 or later for VietIME 1.0; 1.4 or later for VietIME 1.0.1)
  2. Any Java application or applet that employs AWT (TextArea and TextField) and Swing text components. Some examples are JBuilder, NetBeans, Java Studio Creator, Jext, jEdit,...
    Note: To work effectively with Vietnamese documents, a Java application should include provisions for font selection and file opening/saving in Unicode formats.
  3. Vietnamese Unicode fonts

Installing VietIME

To make the Vietnamese IME available to Java applications and applets, its jar file, VietIME.jar, should be copied into the extensions directory of a Java 2 runtime environment. For J2SE v1.4.2, this would be C:\Program Files\Java\j2re1.4.2\lib\ext directory on Windows, /usr/java/j2re1.4.2/lib/ext on Solaris and Linux, or /Library/Java/Extensions on Mac OS X.

You can also specify the extension directory at start-up time by setting the java.ext.dirs system property. For example, if VietIME.jar is placed in C:\VietIME directory, you can make input methods available to your program by the following command:

java -Djava.ext.dirs=C:\VietIME -jar yourprogram.jar

Note to Developers: Java programs run within an integrated development environment—JBuilder, Forte for Java, or NetBeans, e.g.—using the JDK configured for that IDE. Therefore, to enable input of Vietnamese text for software design or testing within IDE, VietIME.jar should also be copied into the extensions directory of the JRE under the JDK used for the IDE, e.g., C:\j2sdk1.4.2\jre\lib\ext on Windows.

Selecting Vietnamese Input Method

After launching a Java application with a text component that supports input methods, the input method can be selected using the input method selection user interface provided by the runtime environment. First, make sure that a text component has the focus—typically, the text component indicates this by showing a blinking insertion point. Then, for Sun's Java 2 Runtime Environment, choose the Select Input Method menu item from the menu that can be pulled down from the top left corner of the window (the System menu on Windows, Window menu on Solaris). One can also right-click on the application's title bar to get this menu. If you have installed J2RE 1.3 or higher and the Select Input Method option still isn't there, then the input method hasn't been installed properly.

For platforms that do not have the Select Input Method menu item in the system menu, such as Linux and Mac OS X, Sun provides an alternative way to select an input method by pressing a user-defined hot key. This way of selecting an input method is also useful for platforms that have the menu item in the system menu, e.g., Solaris and Microsoft Windows. If you press your favorite hot key defined by the Input Method Hot Key tool, the same popup menu discussed previously is displayed.

Input Method Hot Key

For applets running in Java-enabled web browsers with J2RE plug-in installed, the same hot key mechanism for Linux and Mac OS X is applied, in which the hot key, once configured using the input method hot selection key tool, can be pressed to pop up the input method selection menu when the text component in the applet gets focus.

input method selection menu

Choose Vietnamese Input Methods and select the desired input method option from the popup menu. Viet IME supports the three most common Vietnamese input methods—VNI, VIQR, and Telex.

Select input method

Activation of IME is typically indicated by the appearance of a small status window that shows the currently selected input method. Initially this window is positioned near the lower right corner of the screen, but it can be moved to a different location. To disable the current Vietnamese Input Method, bring up the popup menu and select System Input Methods; the status window will be hidden subsequently. A context menu has been added to the status window to allow full control of the input engine.

context menu

Users can now start inputting Vietnamese text in the text component that currently has the focus. The underlying operating system should already have Vietnamese Unicode fonts installed, and the Java application should have the ability to select and display them.

Client window

Note: Turn off other Vietnamese keyboard drivers while you use VietIME to avoid interference in interpreting key entries.

Current Limitations

If the caret is moved away from a character or a word waiting for marking (which one, a character or a word, depends on whether a SmartMark option is selected), that character or word loses the ability to accept accent marks. It will need to be re-typed before a diacritical mark can be combined with it.

Note: There's a bug in J2SE v1.3 that prevents proper display of some Vietnamese characters in Java text components on Windows 9x/Me. The bug is fixed in J2SE v1.4.

Note to Linux Users: To make Unicode fonts available to Java applications, you'll need to set the environment variable JAVA_FONTS to the appropriate font paths and then export it. This is usually done in /etc/profile file.


Back