Kevin
Kevin

Reputation: 4128

Associate a keyboard input with a TextField in JavaFX

I am trying to have two JavaFX TextFields, one which takes input using a standard English keyboard/language, and the other using a Japanese keyboard/language.

This answer addresses the problem for Swing, but the JavaFX TextField doesn't have the needed getInputContext() method.

My plan was to either catch a focus event and change the Locale to Japanese, or associate a specific Locale with the Japanese TextField. However, I don't know how to actually achieve either of these.

I have a suspicion the Java Input Method Client API may be needed.

I am using Windows 8, but it would be nice to have a OS independent answer.

Upvotes: 0

Views: 1708

Answers (1)

Marc Rasmussen
Marc Rasmussen

Reputation: 20565

The only thing that comes close that i could find was:

textfield.getText().regionMatches();

however im not sure that this is the one your looking for.

Update

i also found

txt_message.getText().format(Locale.JAPANESE, format, args)

Upvotes: 0

Related Questions