Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

how to make Java handle other language input method (IME) the same as other software?

48f8dbfc-4839-46e3-b792-3fe4d01b414bSep 27 2016 — edited Sep 27 2016

My Java Swing application needs to input Chinese with a Chinese Input Method, like Microsoft Pinyin or Sogou Pinyin, a IME. But we also need to constrain the length user can input.

When we input one Chinese character, there will be few keystrokes to achieve this. In other software, the keystrokes before the final Chinese character seem to be ignored because there is no display for the key letter stroked on these software like these:

1.png2.png

But in our Java Swing application, every keystrokes are accepted and displayed on the screen and eventually these letters will be replaced by that Chinese character at the end of the selection or enter stroke. This makes our length checking almost impossible.

3.png

Note that our application works fine if there is no IME involved.

My questions are these:

1. is there a way in Java to know a IME is in use or not?

2. is there a way to make Java behave like others to ignore these temporary keystrokes on IME before the final result character?

3. is there any way to check the character length while user is inputing?

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 25 2016
Added on Sep 27 2016
0 comments
827 views