@Override
            public void onAction(String name, boolean isPressed, float tpf) {
                if (name.equals("toggle") && isPressed) {
                    if (lm == TechniqueDef.LightMode.SinglePass) {
                        lm = TechniqueDef.LightMode.MultiPass;
                        helloText.setText("(Multi pass)");
                    } else {
                        lm = TechniqueDef.LightMode.SinglePass;
                        helloText.setText("(Single pass) nb lights per batch : " + renderManager.getSinglePassLightBatchSize());
                    }
                    renderManager.setPreferredLightMode(lm);
                    reloadScene(g, boxGeo, cubeNodes);
                }
                if (name.equals("lightsUp") && isPressed) {
                    renderManager.setSinglePassLightBatchSize(renderManager.getSinglePassLightBatchSize() + 1);
                    helloText.setText("(Single pass) nb lights per batch : " + renderManager.getSinglePassLightBatchSize());
                }
                if (name.equals("lightsDown") && isPressed) {
                    renderManager.setSinglePassLightBatchSize(renderManager.getSinglePassLightBatchSize() - 1);
                    helloText.setText("(Single pass) nb lights per batch : " + renderManager.getSinglePassLightBatchSize());
                }
                if (name.equals("toggleOnOff") && isPressed) {
                    for (final Light light : lightList) {
                        if (light instanceof AmbientLight) {
                            continue;
                        }

                        light.setEnabled(!light.isEnabled());
                    }
                }
            }
Switch mode with space bar at run time
jme3-examples/src/main/java/jme3test/light/TestManyLightsSingle.java