protected void reloadScene(Geometry g, Geometry boxGeo, Node cubeNodes) {
        MaterialDebugAppState debug = stateManager.getState(MaterialDebugAppState.class);
        Material m = debug.reloadMaterial(g.getMaterial());
        if (m != null) {
            g.setMaterial(m);
        }
        m = debug.reloadMaterial(boxGeo.getMaterial());
        if (m != null) {
            cubeNodes.setMaterial(m);
        }
    }
Switch mode with space bar at run time
jme3-examples/src/main/java/jme3test/light/TestManyLightsSingle.java