user9985
user9985

Reputation: 172

How to support macOS character input in JavaFX

On a mac pressing and holding certain keys (such as e, i, o) will bring up selection menu like the one below. Pressing one of the numbers shown will type the character associated with it. This feature does not seem to work in any JavaFX8's TextField. Does anyone know how to fix this?

macOS character selection

enter image description here

E.g.

If I press and hold the e key, a single e will be typed regardless of how long I hold it and this menu will popup. Then if I press 2, the "e" will be replaced with an "é". In a TextField this does not happen. Instead of getting "é" i get "eeeeeee2".

Upvotes: 1

Views: 395

Answers (1)

trashgod
trashgod

Reputation: 205785

I'm not sure how to create the input widget shown. As a workaround, open System Preferences > Keyboard, select Show Keyboard, Emoji and Symbol Viewers in menu bar and choose Show Keyboard Viewer from the menu bar.

Keyboard Viewer

Use the option key to highlight the available modifiers. For example, option-` followed by e enters è. You can also choose Show Emoji and Symbols for other symbols. Here's the result using this example on my keyboard/language combination:

image

See also MacOS Sierra: Enter characters with accent marks.

Upvotes: 1

Related Questions