Chinese Text Input

So I had this idea to create an old-style text-parser-based adventure game, with the catch being that it’d had to be in Chinese (because I’m learning Chinese and could use the practice).

So I was wondering how to go about creating a text input field in Java that allows the user to type Mandarin characters using the pinyin input* method (or alternatives).

I’m not sure if the input is handled at the OS level, or if the application needs to know what to do.

From my experience I’d say some parsers use internal dictionaries, because typing several pinyin entries together will often eliminate invalid characters. (Say, typing “nihao” will result in “你好” - “Hi” instead of, say, “尼浩” - “??”)

*Pinyin Input: For those who don’t know what I’m talking about, in order to input Chinese characters using a standard keyboard, what you do is type the pinyin (pronunciation) and a list of homophone characters is displayed allowing the user to select them. For example, typing “wo” you’d get a list with homophones such as this: 1我 2沃 3握… So typing “wo1” would result in 我 (“I” as in “I am”)

PS: Sorry if you can’t see the chinese characters.

So I seem to have been a victim of the Failed Search Gremlin (you know, when you look for something and find no results… Only to look again with a slightly different approach and find what you were looking for).

Found the following info on Pinyin IMEs:

And the following example apps: