@Override
    public void initialize(AppStateManager stateManager, Application app) {
        super.initialize(stateManager, app);

        this.app = app;

        if (app.getInputManager() != null) {

            if (flyCam == null) {
                flyCam = new FlyByCamera(app.getCamera());
            }

            flyCam.registerWithInput(app.getInputManager());
        }
    }
This is called by SimpleApplication during initialize().
jme3-core/src/main/java/com/jme3/app/FlyCamAppState.java