Naoko Hamamoto's Weblog

« JavaFX Documents Now... | Main | Localized JavaFX... »

20090113 Tuesday January 13, 2009

Java Input Method Testing on Windows and Mac

I know Java input method has been around for quite some time, but I have never really had a chance to play with it until now. Our JavaFX i18n team is working on implementing the on-the-spot input method feature for JavaFX (not yet released) so I am working on familiarizing myself with this technology. I am writing this entry more for myself and my team, but hopefully other readers will also find it useful.

I am focusing on Windows and Mac platforms now, as these are the currently supported platforms for JavaFX.

So what is Java input method? It's all described here: Using Input Methods on the JavaTM Platform.

Let's use City Input Method as an example for testing.

Windows Platform

1. Download City Input Method jar file from here.

2. Copy the jar file into the extension directory.
# cp CityIM.jar <JDK_HOME>/jre/lib/ext

Note: Make sure to copy it to jre/lib/ext, not lib/ext!

3. Write a Swing-based application (I just grabbed this source file but any Swing-based application with text component should do).

4. Compile and Run.
# javac CelsiusConverterGUI.java
# java CelsiusConverterGUI

5. Click on the System menu and now we should see a new menu item, called "Select Input Method".

Mac Platform

1. Download City Input Method jar file from here.

2. Copy the jar file into the extension directory.
# cp CityIM.jar /Library/Java/Extensions

3. Write a Swing-based application (I just grabbed this source file but any Swing-based application with text component should do).

4. Enable Java input method.

This step is different from Windows platform. We need to use an alternative method of selecting an input method by pressing a user-defined hot key. We need to configure it first.

# cd /Applications/Utilities/Java
# open -a "Input Method Hotkey.app"

This brings up the following window, where we can specify the hot key for Java input method. I am going to use Ctrl-a.

5. Compile and Run.
# javac CelsiusConverterGUI.java
# java CelsiusConverterGUI

6. Hit Ctrl-a when the focus is on the application, and we should see the input method selection window popping up, as below.

Pretty neat!

Posted by naoko ( Jan 13 2009, 02:27:39 PM PST ) Permalink Comments [0]

Trackback URL: http://blogs.sun.com/naoko/entry/java_input_method_testing_in
Comments:

Post a Comment:

Name:
E-Mail:
URL:

Your Comment:

HTML Syntax: NOT allowed

Valid HTML! Valid CSS!

This is a personal weblog, I do not speak for my employer.