[SOLVED] KeyTrigger with umlauts


I’m using the following code to get Input from the Keyboard e.g.

inputManager.addMapping("Taste_L", new KeyTrigger(KeyInput.KEY_L));

inputManager.addListener(actionListener, "Taste_L")

public void onAction(String name, boolean keyPressed, float tpf) {

if (name.equals("Taste_L") & !keyPressed  ){       // Öffnen Dialog 
    do something

My Problem is that I’m a kraut and I have to use umlauts like ä, ü, ö for input but there is no KeyInput for them. Is there a way to solve this problem?
I tried to use KeyTrigger(142) or KeyTrigger(142) instead (ASCII-Codes) but it dosn’t work.

1 Like

The codes in KeyInput aren’t ASCII or Unicode codes for glyphs, they’re more like scan codes, which usually correspond to locations on the keyboard. The names in “KeyInput.java” are based on a US keyboard, so they’ll be confusing if you have a German keyboard.

Keyboard localization depends on whether you’re using v2 or v3 of LWJGL.

  • If you’re using the “jme3-lwjgl” library, you’re using v2.
  • If you’re using the “jme3-lwjgl3” library, you’re using v3.

I recommend using v3, if you can.

Comparing the layouts, the “ö” key on the German layout is located where the “; :” key is in the US layout, so for that key, try instantiating a trigger with keycode 0x27 (KeyInput.KEY_SEMICOLON).

1 Like

As sgold indicates, the KEY_L style KeyInput constants are just mnemonics for the scan code which has more to do with the physical layout of the keyboard than any sort of “ASCII value”.

You can add a RawInputListener to see what the key code is for the key you want to hit. This is also how one would start to implement something that let’s the user choose their mappings… which in the end is the only way that will work for everyone.


@Edmund Is your problem solved?