سؤال

I've some trouble for an unknown reason in Java LibGDX scene2dui. I've this code:

@Override
public void show() {
    stage  = new Stage();
    //blablabla...
    Gdx.input.setInputProcessor(stage);

    exitButton = new TextButton("Exit", textButtonStyle);

    exitButton.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            System.out.print("EXITTTTTTTT");
            //Gdx.app.exit();
        }
    });
    //blabla...
}

I don't know why, but java gives me a compilation error on the @Override annotation:

java: method does not override or implement a method from a supertype

I set my java compiler in Javac 1.6 (but maybe there are other settings for the project?) If I comment out the annotation it compiles but does nothing on click.

EDIT: I checked the import, it's OK for the badlogic inputEvent. My class "implements" screen". Maybe I should "extends"?

هل كانت مفيدة؟

المحلول

OK, Thanks a lot for your help. The comment of Chase is the right answer for my problem. It's a little idiot, but I've import:

java.awt.event.InputEvent

instead of:

com.badlogic.gdx.scenes.scene2d.InputEvent

Ty to all!

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top