Key Events not working?

Hi, i have got the line of code:

public void onKeyDown(KeyTrigger e){
System.out.println(“hi”);
}

Just a test for other things i am doing, but it does not work!! I have tried KeyEvent too - which works fine on eclipse. I have all the nececcary imports, but it still does not work.

Any idea why?

uh? where did you get that from. Look at actionlistener/analoglistener

“Choose one or several key/mouse events for the interaction. We use KeyTrigger”
Could you please give me a link to the page you are referring to?

Tried

private ActionListener actionListener = new ActionListener(){
public void onAction(String name, boolean pressed, float tpf){
System.out.println(name + " = " + pressed);
}
};
public AnalogListener analogListener = new AnalogListener() {
public void onAnalog(String name, float value, float tpf) {
System.out.println(name + " = " + value);
}
};

Does not work either.

Anyone?

We can’t see the relevant code… either you aren’t registering them or you are registering them incorrectly.

Have you run through the tutorials yet? I’m pretty sure they cover this topic.

so this doesn’t work?

https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:beginner:hello_input_system