How does the input system work (using Canvas + AWTInput (+ FengGUI))?

Hi again.

This time, I have trouble using the input system within a Canvas. However, my question is very simple. Why doesn't my listener get called (which should also solve the question why FengGUI doesn't receive any input):

My SimpleCanvasImplementor{} is:

public class JMEAdapter extends SimpleCanvasImpl {
    final Logger logger = Logger.getLogger(this.getClass().getName());

    final VirtualWorld virtualWorld;

    final Canvas canvas;

    TextureUtils textureUtils;

    private Display fengGuiDisplay;

    private FengJMEInputHandler fengInput;

    public JMEAdapter(VirtualWorld virtualWorld, Canvas canvas, int width, int height) {
        super(width, height);

        this.canvas = canvas;
        this.virtualWorld = virtualWorld;

    public void doUpdate() {

        // Update our JME nodes according to the virtualWorld

        // Next place and update the context bars and the rectangles
        GeometryUtils.updateGeometry(this.virtualWorld, getRootNode());

        // Load all required things (textures, ...) and drop the old ones.

        // Then, update the world positions (lateInitialized.e., camera).

    public void simpleSetup() {
        this.textureUtils = new TextureUtils(this.renderer);

        AWTMouseInput.setup(this.canvas, false);

        AWTMouseInput.get().addListener(new MouseInputListener() {

            public void onButton(int arg0, boolean arg1, int arg2, int arg3) {

            public void onMove(int arg0, int arg1, int arg2, int arg3) {
                // TODO Auto-generated method stub


            public void onWheel(int arg0, int arg1, int arg2) {
                // TODO Auto-generated method stub



        // Try antialiasing


    private void initGUI() {

        this.fengGuiDisplay = new Display(new AWTGLCanvasBinding((AWTGLCanvas) this.canvas));
        this.fengInput = new FengJMEInputHandler(this.fengGuiDisplay);

        // Create a dialog and set it to some location on the screen
        Window frame = new Window();
        frame.setSize(100, 100);

        // Update the display with the newly added components

    public void doRender() {

        if (this.fengGuiDisplay != null) this.fengGuiDisplay.display();


The FengJMEInputHandler{} is almost the same as the ones within the forum; however, I also played with the constructor (the original didn't work either):

    public FengJMEInputHandler(Display disp) {
        this.disp = disp;

        this.keyAction = new KeyAction();
        addAction(this.keyAction, DEVICE_KEYBOARD, BUTTON_ALL, AXIS_NONE, false);

        AWTMouseInput.get().addListener(new MouseListener());

It took me quite a long time to figure out that I apparently had to use the AWT***Input classes to get at least rid of those very annoying "Display has to be created first", "Mouse has to be created" exceptions.  But now, I just don't know any further. What do I have to do, to properly receive input messages within my Canvas / FengGUI?

Thanks a lot!

I can plug your above input listener into AppletTestBoxColor and it works fine (remove those override annotations though.)  Probably you aren't completely initing the input and calling update on it like you think you are.  I recommend checking out the code in SimpleJMEApplet for ideas.