I am on the tutorial “Hello Input System” and have a problem with the actionListenter.
This is the part of code where the problem is:
[java] private void initKeys() {
// You can map one or several inputs to one named action
inputManager.addMapping(“Pause”, new KeyTrigger(KeyInput.KEY_P));
inputManager.addMapping(“Left”, new KeyTrigger(KeyInput.KEY_J));
inputManager.addMapping(“Right”, new KeyTrigger(KeyInput.KEY_K));
inputManager.addMapping(“Rotate”, new KeyTrigger(KeyInput.KEY_SPACE),
new MouseButtonTrigger(MouseInput.BUTTON_LEFT));
// Add the names to the action listener.
inputManager.addListener(actionListener, new String[]{“Pause”});
inputManager.addListener(analogListener, new String[]{“Left”, “Right”, “Rotate”});
}[/java]
The addMapping works well, but if i want to add a Listener below jME says "actionListener has private access in com.jme3.app.simpleApplication. Is there a work around for that problem or an opportunity to change that private in protected?
You have to define your own action listener, read the whole tutorial…
Okay there was again an error in the tutorial code…
There was
[java]private ActionListener()[/java]
but there has to be [java]private ActionListener actionListener = new ActionListener()[/java]
wheres the error in the tutorial code? i dont see it
It was in the tutorial code in jME, not in the forum. There wasn’t created a new ActionListener but only the command “ActionListener()”.